private static Gdk.Rectangle [] GetRectangles(Gdk.Region region)
        {
#if true
            return(new Gdk.Rectangle [] { region.Clipbox });
#else
            return(region.GetRectangles());
#endif
        }
Пример #2
0
        public static bool RectangleInsideGdkRegion(RectangleD r, Gdk.Region region)
        {
            r.Inflate(1.0, 1.0);
            Gdk.Rectangle   gdkRect = GdkRectangle(r);
            Gdk.OverlapType type    = region.RectIn(gdkRect);

            return(type == Gdk.OverlapType.In || type == Gdk.OverlapType.Part);
        }
Пример #3
0
        private void PreloadRegion(Gdk.Region region, int step)
        {
            Gdk.Rectangle [] rects = region.GetRectangles();

            if (step < 0)
            {
                Array.Reverse(rects);
            }

            foreach (Gdk.Rectangle preload in rects)
            {
                Preload(preload, false);
            }
        }
Пример #4
0
        protected override bool OnMotionNotifyEvent(EventMotion evnt)
        {
            int pos = (int)(evnt.X * pixelRatio);

            //If not moving don't do anything
            if (!movingLimit)
            {
            }
            //Moving Start time
            else if (candidateStart)
            {
                if (candidateTN.HasDrawings && pos > 0 && pos > candidateTN.KeyFrame - 10)
                {
                    candidateTN.StartFrame = candidateTN.KeyFrame - 10;
                }
                //Check not to go under start time nor 0
                else if (pos > 0 && pos < candidateTN.StopFrame - 10)
                {
                    candidateTN.StartFrame = (uint)pos;
                }
                HandleTimeNodeChanged(candidateTN, candidateTN.Start);
            }
            //Moving Stop time
            else if (!candidateStart)
            {
                if (candidateTN.HasDrawings && pos < candidateTN.KeyFrame + 10)
                {
                    candidateTN.StopFrame = candidateTN.KeyFrame + 10;
                }
                //Check not to go under start time nor 0
                else if (pos < frames && pos > candidateTN.StartFrame + 10)
                {
                    candidateTN.StopFrame = (uint)pos;
                }
                HandleTimeNodeChanged(candidateTN, candidateTN.Stop);
            }

            Gdk.Region region = GdkWindow.ClipRegion;
            GdkWindow.InvalidateRegion(region, true);
            GdkWindow.ProcessUpdates(true);

            return(base.OnMotionNotifyEvent(evnt));
        }
Пример #5
0
 public void ReDraw(Area area = null)
 {
     if (widget.GdkWindow == null)
     {
         return;
     }
     if (area == null)
     {
         Gdk.Region region = widget.GdkWindow.ClipRegion;
         widget.GdkWindow.InvalidateRegion(region, true);
     }
     else
     {
         widget.GdkWindow.InvalidateRect(
             new Gdk.Rectangle((int)area.Start.X - 1, (int)area.Start.Y - 1,
                               (int)Math.Ceiling(area.Width) + 2,
                               (int)Math.Ceiling(area.Height) + 2),
             true);
     }
     widget.GdkWindow.ProcessUpdates(true);
 }
Пример #6
0
	// Scrolling.  We do this in an idle loop so we can catch up if the user scrolls quickly.

	private void Scroll ()
	{
		int ystep = (int)(Vadjustment.Value - y_offset);
		int xstep = (int)(Hadjustment.Value - x_offset);
		
		if (xstep > 0)
			xstep = Math.Max (xstep, Allocation.Width);
		else 
			xstep = Math.Min (xstep, -Allocation.Width);

		if (ystep > 0)
			ystep = Math.Max (ystep, Allocation.Height);
		else 
			ystep = Math.Min (ystep, -Allocation.Height);

		Gdk.Rectangle area;

		Gdk.Region offscreen = new Gdk.Region ();
		/*
		System.Console.WriteLine ("step ({0}, {1}) allocation ({2},{3},{4},{5})", 
					  xstep, ystep, Hadjustment.Value, Vadjustment.Value, 
					  Allocation.Width, Allocation.Height);
		*/
		/*		
		area = new Gdk.Rectangle (Math.Max ((int) (Hadjustment.Value + 4 * xstep), 0),  
					  Math.Max ((int) (Vadjustment.Value + 4 * ystep), 0),
					  Allocation.Width,
					  Allocation.Height);
		offscreen.UnionWithRect (area);
		area = new Gdk.Rectangle (Math.Max ((int) (Hadjustment.Value + 3 * xstep), 0),  
					  Math.Max ((int) (Vadjustment.Value + 3 * ystep), 0),
					  Allocation.Width,
					  Allocation.Height);
		offscreen.UnionWithRect (area);
		*/
		area = new Gdk.Rectangle (Math.Max ((int) (Hadjustment.Value + 2 * xstep), 0),  
					  Math.Max ((int) (Vadjustment.Value + 2 * ystep), 0),
					  Allocation.Width,
					  Allocation.Height);
		offscreen.UnionWithRect (area);
		area = new Gdk.Rectangle (Math.Max ((int) (Hadjustment.Value + xstep), 0),  
					  Math.Max ((int) (Vadjustment.Value + ystep), 0),
					  Allocation.Width,
					  Allocation.Height);		
		offscreen.UnionWithRect (area);
		area = new Gdk.Rectangle ((int) Hadjustment.Value, 
					  (int) Vadjustment.Value,
					  Allocation.Width,
					  Allocation.Height);

		// always load the onscreen area last to make sure it
		// is first in the loading
		Gdk.Region onscreen = Gdk.Region.Rectangle (area);
		offscreen.Subtract (onscreen);

		PreloadRegion (offscreen, ystep);
		Preload (area, false);

		y_offset = (int) Vadjustment.Value;
		x_offset = (int) Hadjustment.Value;
	}
Пример #7
0
 public void ReDraw()
 {
     Gdk.Region region = GdkWindow.ClipRegion;
     GdkWindow.InvalidateRegion(region, true);
     GdkWindow.ProcessUpdates(true);
 }
Пример #8
0
        private void Scroll()
        {
            int ystep = (int)(Vadjustment.Value - y_offset);
            int xstep = (int)(Hadjustment.Value - x_offset);

            if (xstep > 0)
            {
                xstep = Math.Max(xstep, Allocation.Width);
            }
            else
            {
                xstep = Math.Min(xstep, -Allocation.Width);
            }

            if (ystep > 0)
            {
                ystep = Math.Max(ystep, Allocation.Height);
            }
            else
            {
                ystep = Math.Min(ystep, -Allocation.Height);
            }

            Gdk.Rectangle area;

            Gdk.Region offscreen = new Gdk.Region();

            /*
             * Log.Debug ("step ({0}, {1}) allocation ({2},{3},{4},{5})",
             *      xstep, ystep, Hadjustment.Value, Vadjustment.Value,
             *      Allocation.Width, Allocation.Height);
             */
            /*
             * area = new Gdk.Rectangle (Math.Max ((int) (Hadjustment.Value + 4 * xstep), 0),
             *      Math.Max ((int) (Vadjustment.Value + 4 * ystep), 0),
             *      Allocation.Width,
             *      Allocation.Height);
             * offscreen.UnionWithRect (area);
             * area = new Gdk.Rectangle (Math.Max ((int) (Hadjustment.Value + 3 * xstep), 0),
             *      Math.Max ((int) (Vadjustment.Value + 3 * ystep), 0),
             *      Allocation.Width,
             *      Allocation.Height);
             * offscreen.UnionWithRect (area);
             */
            area = new Gdk.Rectangle(Math.Max((int)(Hadjustment.Value + 2 * xstep), 0),
                                     Math.Max((int)(Vadjustment.Value + 2 * ystep), 0),
                                     Allocation.Width,
                                     Allocation.Height);
            offscreen.UnionWithRect(area);
            area = new Gdk.Rectangle(Math.Max((int)(Hadjustment.Value + xstep), 0),
                                     Math.Max((int)(Vadjustment.Value + ystep), 0),
                                     Allocation.Width,
                                     Allocation.Height);
            offscreen.UnionWithRect(area);
            area = new Gdk.Rectangle((int)Hadjustment.Value,
                                     (int)Vadjustment.Value,
                                     Allocation.Width,
                                     Allocation.Height);

            // always load the onscreen area last to make sure it
            // is first in the loading
            Gdk.Region onscreen = Gdk.Region.Rectangle(area);
            offscreen.Subtract(onscreen);

            PreloadRegion(offscreen, ystep);
            Preload(area, false);

            y_offset = (int)Vadjustment.Value;
            x_offset = (int)Hadjustment.Value;
        }
Пример #9
0
 public static void Region(Cairo.Context ctx, Gdk.Region region)
 {
     gdk_cairo_region(ctx.Handle, region.Handle);
 }