diff --git a/src/Converters/FilesDisplayModeToVisibility.cs b/src/Converters/FilesDisplayModeToVisibility.cs
new file mode 100644
index 00000000..edcb45ea
--- /dev/null
+++ b/src/Converters/FilesDisplayModeToVisibility.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace SourceGit.Converters {
+
+ public class FilesDisplayModeToIcon : IValueConverter {
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
+ var mode = (Git.Preference.FilesDisplayMode)value;
+ switch (mode) {
+ case Git.Preference.FilesDisplayMode.Grid:
+ return App.Current.FindResource("Icon.Grid") as Geometry;
+ case Git.Preference.FilesDisplayMode.List:
+ return App.Current.FindResource("Icon.List") as Geometry;
+ default:
+ return App.Current.FindResource("Icon.Tree") as Geometry;
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class FilesDisplayModeToList : IValueConverter {
+
+ public bool TreatGridAsList { get; set; } = true;
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
+ var mode = (Git.Preference.FilesDisplayMode)value;
+ if (mode == Git.Preference.FilesDisplayMode.Tree) return Visibility.Collapsed;
+ if (mode == Git.Preference.FilesDisplayMode.List) return Visibility.Visible;
+ if (TreatGridAsList) return Visibility.Visible;
+ return Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class FilesDisplayModeToGrid : IValueConverter {
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
+ return (Git.Preference.FilesDisplayMode)value == Git.Preference.FilesDisplayMode.Grid ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class FilesDisplayModeToTree : IValueConverter {
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
+ return (Git.Preference.FilesDisplayMode)value == Git.Preference.FilesDisplayMode.Tree ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Converters/Path.cs b/src/Converters/Path.cs
new file mode 100644
index 00000000..8062b658
--- /dev/null
+++ b/src/Converters/Path.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Globalization;
+using System.IO;
+using System.Windows.Data;
+
+namespace SourceGit.Converters {
+
+ public class PathToFileName : IValueConverter {
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
+ return Path.GetFileName(value as string);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class PathToFolderName : IValueConverter {
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
+ return Path.GetDirectoryName(value as string);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Git/Preference.cs b/src/Git/Preference.cs
index 08e9a3bd..0892e585 100644
--- a/src/Git/Preference.cs
+++ b/src/Git/Preference.cs
@@ -32,6 +32,15 @@ namespace SourceGit.Git {
public bool IsExpended { get; set; }
}
+ ///
+ /// File's display mode.
+ ///
+ public enum FilesDisplayMode {
+ Tree,
+ List,
+ Grid,
+ }
+
#region STATICS
///
/// Storage path for Preference.
@@ -99,15 +108,15 @@ namespace SourceGit.Git {
///
public bool UIUseHorizontalLayout { get; set; }
///
- /// Use list instead of tree in unstaged view
+ /// Files' display mode in unstage view.
///
- public bool UIUseListInUnstaged { get; set; }
+ public FilesDisplayMode UIUnstageDisplayMode { get; set; } = FilesDisplayMode.Grid;
///
- /// Use list instead of tree in staged view.
+ /// Files' display mode in staged view.
///
- public bool UIUseListInStaged { get; set; }
+ public FilesDisplayMode UIStagedDisplayMode { get; set; } = FilesDisplayMode.Grid;
///
- /// Use list instead of tree in change view.
+ /// Using datagrid instead of tree in changes.
///
public bool UIUseListInChanges { get; set; }
///
diff --git a/src/Resources/Icons.xaml b/src/Resources/Icons.xaml
index 334b0f2b..88ea9be3 100644
--- a/src/Resources/Icons.xaml
+++ b/src/Resources/Icons.xaml
@@ -20,6 +20,7 @@
M51.2 204.8h102.4v102.4H51.2V204.8z m204.8 0h716.8v102.4H256V204.8zM51.2 460.8h102.4v102.4H51.2V460.8z m204.8 0h716.8v102.4H256V460.8z m-204.8 256h102.4v102.4H51.2v-102.4z m204.8 0h716.8v102.4H256v-102.4z
M912 737l0 150L362 887l0-100 0-50 0-150 0-150 0-150L112 287l0-150 450 0 0 150L412 287l0 150L912 437l0 150L412 587l0 150L912 737z
+ M256 256l220.16 0 0 220.16-220.16 0 0-220.16ZM547.84 256l220.16 0 0 220.16-220.16 0 0-220.16ZM256 547.84l220.16 0 0 220.16-220.16 0 0-220.16ZM547.84 547.84l220.16 0 0 220.16-220.16 0 0-220.16Z
M868 545.5L536.1 163c-12.7-14.7-35.5-14.7-48.3 0L156 545.5c-4.5 5.2-0.8 13.2 6 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z
M862 465.3h-81c-4.6 0-9 2-12.1 5.5L550 723.1V160c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v563.1L255.1 470.8c-3-3.5-7.4-5.5-12.1-5.5h-81c-6.8 0-10.5 8.1-6 13.2L487.9 861c12.7 14.7 35.5 14.7 48.3 0L868 478.5c4.5-5.2 0.8-13.2-6-13.2z
diff --git a/src/UI/FilesDisplayModeSwitch.xaml b/src/UI/FilesDisplayModeSwitch.xaml
new file mode 100644
index 00000000..2cf68667
--- /dev/null
+++ b/src/UI/FilesDisplayModeSwitch.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/UI/FilesDisplayModeSwitch.xaml.cs b/src/UI/FilesDisplayModeSwitch.xaml.cs
new file mode 100644
index 00000000..44f74597
--- /dev/null
+++ b/src/UI/FilesDisplayModeSwitch.xaml.cs
@@ -0,0 +1,46 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace SourceGit.UI {
+
+ ///
+ /// Interaction logic for FilesDisplayModeSwitch.xaml
+ ///
+ public partial class FilesDisplayModeSwitch : UserControl {
+
+ public static readonly DependencyProperty ModeProperty =
+ DependencyProperty.Register(
+ "Mode",
+ typeof(Git.Preference.FilesDisplayMode),
+ typeof(FilesDisplayModeSwitch),
+ new PropertyMetadata(Git.Preference.FilesDisplayMode.Grid));
+
+ public Git.Preference.FilesDisplayMode Mode {
+ get { return (Git.Preference.FilesDisplayMode)GetValue(ModeProperty); }
+ set { SetValue(ModeProperty, value); }
+ }
+
+ public FilesDisplayModeSwitch() {
+ InitializeComponent();
+ }
+
+ private void OpenModeSelector(object sender, RoutedEventArgs e) {
+ selector.PlacementTarget = sender as Button;
+ selector.IsOpen = true;
+ e.Handled = true;
+ }
+
+ private void UseGrid(object sender, RoutedEventArgs e) {
+ Mode = Git.Preference.FilesDisplayMode.Grid;
+ }
+
+ private void UseList(object sender, RoutedEventArgs e) {
+ Mode = Git.Preference.FilesDisplayMode.List;
+ }
+
+ private void UseTree(object sender, RoutedEventArgs e) {
+ Mode = Git.Preference.FilesDisplayMode.Tree;
+ }
+ }
+}
diff --git a/src/UI/WorkingCopy.xaml b/src/UI/WorkingCopy.xaml
index cfb2cf5a..f86e4ddc 100644
--- a/src/UI/WorkingCopy.xaml
+++ b/src/UI/WorkingCopy.xaml
@@ -18,6 +18,12 @@
+
+
+
+
+
+
@@ -51,13 +57,10 @@
-
+