diff --git a/.gitignore b/.gitignore index 3c4efe2..841445c 100644 --- a/.gitignore +++ b/.gitignore @@ -258,4 +258,14 @@ paket-files/ # Python Tools for Visual Studio (PTVS) __pycache__/ -*.pyc \ No newline at end of file +*.pyc + +# vim +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-v][a-z] +[._]sw[a-p] +Session.vim +.netrwhist +*~ +tags diff --git a/ShadowClip/GUI/Converters.cs b/ShadowClip/GUI/Converters.cs index 0bbdbcd..7b7c57d 100644 --- a/ShadowClip/GUI/Converters.cs +++ b/ShadowClip/GUI/Converters.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Windows; @@ -72,6 +73,40 @@ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, } } + public class ShotTime + { + public double Time { get; set; } + public Thickness Margin { get; set; } + } + internal class ShotTimesConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + var none = Enumerable.Empty(); + if (!(values[0] is IEnumerable times)) return none; + if (!(values[1] is TimeSpan duration)) return none; + if (!(values[2] is double width)) return none; + if (duration.Ticks == 0) return none; + + return times.Select(time => + { + var fraction = time / duration.TotalSeconds; + var offset = fraction * width - 4; + + return new ShotTime + { + Margin = new Thickness(offset, 0, 0, 0), + Time = time + }; + }); + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + internal class StateToBoolConverter : ParamConverter { public override object Convert(State state, string parameter) diff --git a/ShadowClip/GUI/VideoView.xaml b/ShadowClip/GUI/VideoView.xaml index 3b7495f..1c2441a 100644 --- a/ShadowClip/GUI/VideoView.xaml +++ b/ShadowClip/GUI/VideoView.xaml @@ -6,12 +6,13 @@ xmlns:cal="http://www.caliburnproject.org" xmlns:gui="clr-namespace:ShadowClip.GUI" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> + d:DesignHeight="300" d:DesignWidth="700"> + @@ -71,36 +72,69 @@ 4x - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + +