/** * PUBLIC METHODS **/ /// <summary> /// Adds a new picture element to the timeline (before the given element) /// </summary> /// <param name="startTime">the start time for the new element</param> /// <param name="endTime">the end time for the new element</param> /// <param name="thumbnail">The path to the picture (should be absolute)</param> /// <param name="transitionId">The ID of the transition which should be shown before the slide (-1 for no transition)</param> /// <param name="transitionExecutionTime">The time the transition should last (in ms). Parameter is ignored if the transition id is invalid</param> /// <param name="addBefore">The element id of the element which should be after the added element</param> public void AddPictureElement(double startTime, double endTime, string thumbnail, int transitionId, int transitionExecutionTime, int addBefore) { TimelinePictureElementControl element = new TimelinePictureElementControl(this, startTime, endTime, thumbnail); element.Transition = Transition.getByID(transitionId); if (element.Transition != null) { element.Transition.ExecutionTime = transitionExecutionTime; } if (addBefore > -1) { //Push All elements and add new element double pushAllTime = endTime - startTime; for (int i = addBefore; i < PictureElements.Count; i++) { PictureElements[i].StartTime += pushAllTime; PictureElements[i].EndTime += pushAllTime; } PictureElements.Insert(addBefore, element); Pack(); } else { PictureElements.Add(element); } if (MainCanvas.ActualWidth < GetLastPictureElementEndtime()) { MainCanvas.Width = GetLastPictureElementEndtime() + 100; MainScrollbar.ScrollToRightEnd(); } UpdateExportButton(); }
/// <summary> /// Adds an empty slide (blank, black) at the end /// </summary> public void AddEmptySlide() { TimelinePictureElementControl element = new TimelinePictureElementControl(this, GetLastPictureElementEndtime(), GetLastPictureElementEndtime() + 200, null); PictureElements.Add(element); if (MainCanvas.ActualWidth < GetLastPictureElementEndtime()) { MainCanvas.Width = GetLastPictureElementEndtime() + 100; MainScrollbar.ScrollToRightEnd(); } }
/// <summary> /// Scroll with the mouse scroller the timeline /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event args</param> private void MainCanvas_MouseWheel(object sender, MouseWheelEventArgs e) { MainScrollbar.ScrollToHorizontalOffset(MainScrollbar.HorizontalOffset - e.Delta); }