mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-28 23:54:59 +00:00
feature<WorkingCopy>: add grid layout for unstaged and staged files mode
This commit is contained in:
parent
ab98191875
commit
8a6d970498
8 changed files with 278 additions and 30 deletions
66
src/Converters/FilesDisplayModeToVisibility.cs
Normal file
66
src/Converters/FilesDisplayModeToVisibility.cs
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
29
src/Converters/Path.cs
Normal file
29
src/Converters/Path.cs
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue