Exemple #1
0
        /// <summary>
        /// Copies the specified slide into a given part.
        /// The copy will be appended to the part's slide list
        /// (can be undone).
        /// </summary>
        /// <param name="slide">The slide to copy.</param>
        /// <param name="target">The part where the copy will be inserted.</param>
        /// <returns>The copy.</returns>
        public SongSlide CopySlide(SongSlide slide, SongPart target)
        {
            SongSlide s;
            var       part = FindPartWithSlide(slide);

            using (Undo.ChangeFactory.Batch(this, "CopySlide"))
            {
                s = slide.Copy();
                target.AddSlide(s);
            }

            return(s);
        }
Exemple #2
0
        /// <summary>
        /// Copies a slide and inserts it after another slide (can be undone).
        /// </summary>
        /// <param name="slide">The slide to copy</param>
        /// <param name="target">The slide after which the copy will be inserted.</param>
        /// <returns>The copy.</returns>
        public SongSlide CopySlideAfter(SongSlide slide, SongSlide target)
        {
            SongSlide s;
            var       part       = FindPartWithSlide(slide);
            var       targetPart = FindPartWithSlide(target);

            using (Undo.ChangeFactory.Batch(this, "CopySlideAfter"))
            {
                s = slide.Copy();
                targetPart.InsertSlideAfter(s, target);
            }

            return(s);
        }
Exemple #3
0
        /// <summary>
        /// Duplicates the specified part and inserts the copy
        /// directly after the original slide in the same part (can be undone).
        /// </summary>
        /// <param name="slide">The slide to duplicate.</param>
        /// <returns>The created duplicate.</returns>
        public SongSlide DuplicateSlide(SongSlide slide)
        {
            SongSlide s;
            int       i = Slides.IndexOf(slide);

            using (Undo.ChangeFactory.Batch(this, "DuplicateSlide"))
            {
                s = slide.Copy();
                Undo.ChangeFactory.OnChanging(this,
                                              () => { slides.Remove(s); },
                                              () => { slides.Insert(i + 1, s); },
                                              "DuplicateSlide");
                slides.Insert(i + 1, s);
            }
            return(s);
        }
Exemple #4
0
		/// <summary>
		/// Copies a slide and inserts it after another slide (can be undone).
		/// </summary>
		/// <param name="slide">The slide to copy</param>
		/// <param name="target">The slide after which the copy will be inserted.</param>
		/// <returns>The copy.</returns>
		public SongSlide CopySlideAfter(SongSlide slide, SongSlide target)
		{
			SongSlide s;
			var part = FindPartWithSlide(slide);
			var targetPart = FindPartWithSlide(target);

			using (Undo.ChangeFactory.Batch(this, "CopySlideAfter"))
			{
				s = slide.Copy();
				targetPart.InsertSlideAfter(s, target);
			}

			return s;
		}
Exemple #5
0
		/// <summary>
		/// Copies the specified slide into a given part.
		/// The copy will be appended to the part's slide list
		/// (can be undone).
		/// </summary>
		/// <param name="slide">The slide to copy.</param>
		/// <param name="target">The part where the copy will be inserted.</param>
		/// <returns>The copy.</returns>
		public SongSlide CopySlide(SongSlide slide, SongPart target)
		{
			SongSlide s;
			var part = FindPartWithSlide(slide);

			using (Undo.ChangeFactory.Batch(this, "CopySlide"))
			{
				s = slide.Copy();
				target.AddSlide(s);
			}

			return s;
		}
Exemple #6
0
 /// <summary>
 /// Duplicates the specified part and inserts the copy
 /// directly after the original slide in the same part (can be undone).
 /// </summary>
 /// <param name="slide">The slide to duplicate.</param>
 /// <returns>The created duplicate.</returns>
 public SongSlide DuplicateSlide(SongSlide slide)
 {
     SongSlide s;
     int i = Slides.IndexOf(slide);
     using (Undo.ChangeFactory.Batch(this, "DuplicateSlide"))
     {
         s = slide.Copy();
         Undo.ChangeFactory.OnChanging(this,
             () => { slides.Remove(s); },
             () => { slides.Insert(i + 1, s); },
             "DuplicateSlide");
         slides.Insert(i + 1, s);
     }
     return s;
 }