예제 #1
0
        /// <summary>
        /// Removes a music element
        /// </summary>
        /// <param name="element">The element which should be removed</param>
        public void RemoveMusicElement(TimelineMusicElementControl element)
        {
            int index = MusicElements.IndexOf(element);

            MusicElements.Remove(element);
            EndElements.Remove(EndElements[index]);
        }
예제 #2
0
 /// <summary>
 /// Returns if the given music element is currently in the visible rendered viewport (used for RAM-savings)
 /// </summary>
 /// <param name="element">The music element to check if it is currently visible</param>
 /// <returns>the visibility state</returns>
 private bool isVisible(TimelineMusicElementControl element)
 {
     if (element.EndTime > MainScrollbar.HorizontalOffset && element.StartTime < MainScrollbar.HorizontalOffset + MainScrollbar.ActualWidth)
     {
         return(true);
     }
     return(false);
 }
예제 #3
0
        /// <summary>
        /// Adds an music element to the specified location (only used to restore old music data)
        /// </summary>
        /// <param name="musicPath">The path to the music track</param>
        public void AddMusicElement(string musicPath, double startTime, double endTime)
        {
            TimelineMusicElementControl element    = new TimelineMusicElementControl(this, startTime, endTime, musicPath);
            TlMusikElementEnde          endElement = new TlMusikElementEnde(this, element);

            MusicElements.Add(element);
            EndElements.Add(endElement);
        }
예제 #4
0
 /// <summary>
 /// Returns the latest music element endtime
 /// </summary>
 /// <returns>latest music element endtime</returns>
 private double GetLastMusicElementEndtime()
 {
     if (MusicElements.Count > 0)
     {
         TimelineMusicElementControl last = MusicElements[MusicElements.Count - 1];
         return(last.EndTime);
     }
     return(0);
 }
예제 #5
0
        /// <summary>
        /// Adds an music element to the next possible part of the slideshow (concating all audios together)
        /// </summary>
        /// <param name="musicPath">The path to the music track</param>
        public void AddMusicElement(string musicPath)
        {
            TagLib.File file = TagLib.File.Create(musicPath);

            TimelineMusicElementControl element = new TimelineMusicElementControl(this, GetLastMusicElementEndtime(), GetLastMusicElementEndtime() + Convert.ToDouble(file.Properties.Duration.TotalMilliseconds / 10), musicPath);
            TlMusikElementEnde          Ende    = new TlMusikElementEnde(this, element);

            MusicElements.Add(element);
            EndElements.Add(Ende);
        }
예제 #6
0
 public TlMusikElementEnde(TimelineControl timeline, TimelineMusicElementControl start)
 {
     InitializeComponent();
     DataContext   = this;
     this.timeline = timeline;
     StartTime     = start.EndTime;
     EndTime       = start.EndTime + 20;
     MusicPath     = start.MusicPath;
     timeline.MainCanvas.Children.Add(this);
     Updateheight();
     update();
     Text.ToolTip = Path.GetFileName(start.MusicPath);
 }
예제 #7
0
        /// <summary>
        /// Returns rather the given coordinates are at an music element or not
        /// </summary>
        /// <param name="x">The given x-Coordinate</param>
        /// <param name="y">The given y-Coordinate</param>
        /// <returns></returns>
        private TimelineMusicElementControl isAtMusicElement(double x, double y)
        {
            TimelineMusicElementControl selectelement = null;

            foreach (TimelineMusicElementControl element in MusicElements)
            {
                if (x >= element.StartTime - 10 && x <= (element.StartTime + 10) &&
                    y > element.TopSpacing && y <= element.TopSpacing + element.ElementHeight)
                {
                    selectelement = element;
                }
            }
            return(selectelement);
        }