Exemplo n.º 1
0
		/// <summary>
		/// A history item for when shapes are finalized.
		/// </summary>
        /// <param name="passedEE">The EditEngine being used.</param>
		/// <param name="icon">The history item's icon.</param>
		/// <param name="text">The history item's title.</param>
		/// <param name="passedUserSurface">The stored UserLayer surface.</param>
		/// <param name="passedUserLayer">The UserLayer being modified.</param>
		/// <param name="passedSelectedPointIndex">The selected point's index.</param>
		/// <param name="passedSelectedShapeIndex">The selected point's shape index.</param>
		/// <param name="passedRedrawEverything">Whether every shape should be redrawn when undoing (e.g. finalization).</param>
        public ShapesHistoryItem(BaseEditEngine passedEE, string icon, string text, ImageSurface passedUserSurface, UserLayer passedUserLayer,
			int passedSelectedPointIndex, int passedSelectedShapeIndex, bool passedRedrawEverything) : base(icon, text)
		{
            ee = passedEE;

			userLayer = passedUserLayer;


			userSurfaceDiff = SurfaceDiff.Create(passedUserSurface, userLayer.Surface, true);

			if (userSurfaceDiff == null)
			{
				userSurface = passedUserSurface;
			}
			else
			{
				(passedUserSurface as IDisposable).Dispose();
			}


			sEngines = BaseEditEngine.SEngines.PartialClone();
			selectedPointIndex = passedSelectedPointIndex;
			selectedShapeIndex = passedSelectedShapeIndex;

			redrawEverything = passedRedrawEverything;
		}
Exemplo n.º 2
0
        /// <summary>
        /// A history item for when text is created, edited, and/or finalized.
        /// </summary>
        /// <param name="icon">The history item's icon.</param>
        /// <param name="text">The history item's title.</param>
        /// <param name="passedTextSurface">The stored TextLayer surface.</param>
        /// <param name="passedUserSurface">The stored UserLayer surface.</param>
        /// <param name="passedTextEngine">The text engine being used.</param>
        /// <param name="passedUserLayer">The UserLayer being modified.</param>
        public TextHistoryItem(string icon, string text, ImageSurface passedTextSurface,
                               ImageSurface passedUserSurface, TextEngine passedTextEngine,
                               UserLayer passedUserLayer) : base(icon, text)
        {
            userLayer = passedUserLayer;


            text_surface_diff = SurfaceDiff.Create(passedTextSurface, userLayer.TextLayer.Layer.Surface, true);

            if (text_surface_diff == null)
            {
                textSurface = passedTextSurface;
            }
            else
            {
                (passedTextSurface as IDisposable).Dispose();
            }


            user_surface_diff = SurfaceDiff.Create(passedUserSurface, userLayer.Surface, true);

            if (user_surface_diff == null)
            {
                userSurface = passedUserSurface;
            }
            else
            {
                (passedUserSurface as IDisposable).Dispose();
            }


            tEngine = passedTextEngine;

            textBounds = new Gdk.Rectangle(userLayer.textBounds.X, userLayer.textBounds.Y, userLayer.textBounds.Width, userLayer.textBounds.Height);
        }
Exemplo n.º 3
0
		/// <summary>
		/// A history item for when text is created, edited, and/or finalized.
		/// </summary>
		/// <param name="icon">The history item's icon.</param>
		/// <param name="text">The history item's title.</param>
		/// <param name="passedTextSurface">The stored TextLayer surface.</param>
		/// <param name="passedUserSurface">The stored UserLayer surface.</param>
		/// <param name="passedTextEngine">The text engine being used.</param>
		/// <param name="passedUserLayer">The UserLayer being modified.</param>
		public TextHistoryItem(string icon, string text, ImageSurface passedTextSurface,
		                       ImageSurface passedUserSurface, TextEngine passedTextEngine,
		                       UserLayer passedUserLayer) : base(icon, text)
		{
			userLayer = passedUserLayer;


			text_surface_diff = SurfaceDiff.Create(passedTextSurface, userLayer.TextLayer.Layer.Surface, true);
			
			if (text_surface_diff == null)
			{
				textSurface = passedTextSurface;
			}
			else
			{
				(passedTextSurface as IDisposable).Dispose();
			}


			user_surface_diff = SurfaceDiff.Create(passedUserSurface, userLayer.Surface, true);

			if (user_surface_diff == null)
			{
				userSurface = passedUserSurface;
			}
			else
			{
				(passedUserSurface as IDisposable).Dispose();
			}


			tEngine = passedTextEngine;

			textBounds = new Gdk.Rectangle(userLayer.textBounds.X, userLayer.textBounds.Y, userLayer.textBounds.Width, userLayer.textBounds.Height);
		}
Exemplo n.º 4
0
		public SimpleHistoryItem (string icon, string text, ImageSurface oldSurface, int layerIndex) : base (icon, text)
		{
			layer_index = layerIndex;
			surface_diff = SurfaceDiff.Create (oldSurface, PintaCore.Layers[layer_index].Surface);

			// If the diff was too big, store the original surface, else, dispose it
			if (surface_diff == null)
				old_surface = oldSurface;
			else
				(oldSurface as IDisposable).Dispose ();
		}
Exemplo n.º 5
0
        public SimpleHistoryItem(string icon, string text, ImageSurface oldSurface, int layerIndex) : base(icon, text)
        {
            layer_index  = layerIndex;
            surface_diff = SurfaceDiff.Create(oldSurface, PintaCore.Layers[layer_index].Surface);

            // If the diff was too big, store the original surface, else, dispose it
            if (surface_diff == null)
            {
                old_surface = oldSurface;
            }
            else
            {
                (oldSurface as IDisposable).Dispose();
            }
        }