Exemple #1
0
        private void HandleDrawingMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            int x, y;

            Gdk.ModifierType mask;
            GdkExtensions.GetWindowPointer(drawing.Window, out x, out y, out mask);

            if (x < 0 || x >= size || y < 0 || y >= size)
            {
                return;
            }

            if (args.Event.State == Gdk.ModifierType.Button1Mask)
            {
                // first and last control point cannot be removed
                if (last_cpx != 0 && last_cpx != size - 1)
                {
                    foreach (var controlPoints in GetActiveControlPoints())
                    {
                        if (controlPoints.ContainsKey(last_cpx))
                        {
                            controlPoints.Remove(last_cpx);
                        }
                    }
                }

                AddControlPoint(x, y);
            }

            InvalidateDrawing();
        }
Exemple #2
0
        private void HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            int px, py;

            Gdk.ModifierType mask;
            GdkWindow.GetPointer(out px, out py, out mask);

            int index = FindValueIndex(py);

            py = (int)NormalizeY(index, py);

            if (mask == Gdk.ModifierType.Button1Mask)
            {
                if (index != -1)
                {
                    double y = GetValueFromY(py);

                    vals[index] = y;
                    OnValueChanged(index);
                }
            }

            //to avoid unnessesary costly redrawing
            if (index != -1)
            {
                GdkWindow.Invalidate();
            }
        }
Exemple #3
0
    void OnMotion(object o, Gtk.MotionNotifyEventArgs args)
    {
        var x = margin.x + (current.x + 1) * size + size / 2;
        var y = margin.y + (current.y + 1) * size + size / 2;

        Pos cursor;

        Gdk.ModifierType mask;
        args.Event.Window.GetPointer(out cursor.x, out cursor.y, out mask);
        if (cursor.x > x + size && cursor.y > y - size && cursor.y < y + size)
        {
            Go(new Pos(current.x + 1, current.y));
        }
        else if (cursor.x < x - size && cursor.y > y - size && cursor.y < y + size)
        {
            Go(new Pos(current.x - 1, current.y));
        }
        else if (cursor.y > y + size && cursor.x > x - size && cursor.x < x + size)
        {
            Go(new Pos(current.x, current.y + 1));
        }
        else if (cursor.y < y - size && cursor.x > x - size && cursor.x < x + size)
        {
            Go(new Pos(current.x, current.y - 1));
        }
    }
Exemple #4
0
 protected virtual void OnDrawingareaMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     if (designService.IsDesign)
     {
         designService.MouseMove(args.Event.X, args.Event.Y);
         workSpaceService.Status(String.Format("move x:{0} y:{1}", args.Event.X, args.Event.Y));
     }
 }
Exemple #5
0
        void HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            int cx, cy;

            Gtk.TreeIter iter;
            if (rendererTarget.GetCellPosition(CellRenderer, (int)args.Event.X, (int)args.Event.Y, out cx, out cy, out iter))
            {
                var rect = rendererTarget.GetCellBackgroundBounds(target, CellRenderer, iter);

                if (rect.Contains(cx, cy))
                {
                    if (enabledEvents.HasFlag(WidgetEvent.MouseMoved))
                    {
                        ApplicationContext.InvokeUserCode(delegate {
                            LoadData(rendererTarget.Model, iter);
                            SetCurrentEventRow();
                            EventSink.OnMouseMoved(new MouseMovedEventArgs(args.Event.Time, cx, cy));
                        });
                    }

                    if (!mouseInsideCell)
                    {
                        mouseInsideCell = true;
                        if (enabledEvents.HasFlag(WidgetEvent.MouseEntered))
                        {
                            ApplicationContext.InvokeUserCode(delegate {
                                LoadData(rendererTarget.Model, iter);
                                SetCurrentEventRow();
                                EventSink.OnMouseEntered();
                            });
                        }
                    }
                }
                else if (mouseInsideCell)
                {
                    mouseInsideCell = false;
                    if (enabledEvents.HasFlag(WidgetEvent.MouseExited))
                    {
                        ApplicationContext.InvokeUserCode(delegate {
                            LoadData(rendererTarget.Model, iter);
                            SetCurrentEventRow();
                            EventSink.OnMouseExited();
                        });
                    }
                }
            }
            else if (mouseInsideCell)
            {
                mouseInsideCell = false;
                if (enabledEvents.HasFlag(WidgetEvent.MouseExited))
                {
                    ApplicationContext.InvokeUserCode(delegate {
                        LoadData(rendererTarget.Model, iter);
                        EventSink.OnMouseExited();
                    });
                }
            }
        }
Exemple #6
0
        private void base_MotionNotifyEvent(object sender, Gtk.MotionNotifyEventArgs args)
        {
            Gdk.EventMotion em = args.Event;
            if (debug)
            {
                Console.Out.WriteLine("Motion event: nodeDragging {0}, user coords {1},{2}", nodeDragging, em.X, em.Y);
            }
            double mouseX = em.X;
            double mouseY = em.Y;

            DeviceToUser(ref mouseX, ref mouseY);
            PointD thePoint = new PointD(mouseX, mouseY);

            hoverNode = null;
            foreach (Network network in networkZOrder)
            {
                foreach (Node n in network.Nodes.Values)
                {
                    if (n.Properties.ContainsKey("position"))
                    {
                        PointD np = (PointD)n.Properties["position"];
                        if (Inside(thePoint, np, AvatarSizeD))
                        {
                            hoverNode = n;
                            break;
                        }
                    }
                }
            }

            //if (debug) Console.Out.WriteLine ("MotionNotifyEventHandler called!");
            if (!nodeDragging)
            {
                if (debug)
                {
                    Console.Out.WriteLine("not nodedragging motion!");
                }
                this.QueueDraw();
                return;
            }

            mouseX = em.X;
            mouseY = em.Y;

            double deltaX, deltaY;

            deltaX = mouseX - nodeDraggingLastX;
            deltaY = mouseY - nodeDraggingLastY;
            PointD pos = selectedGroup.Position;

            pos.X                 += (deltaX / this.ScaleFactor);
            pos.Y                 += (deltaY / this.ScaleFactor);
            nodeDraggingLastX      = em.X;
            nodeDraggingLastY      = em.Y;
            selectedGroup.Position = pos;
            this.QueueDraw();
        }
Exemple #7
0
	void MotionNotifyEventHandler (object o, MotionNotifyEventArgs args)
	{
		if (!is_dragging)
			return;

		int x, y;
		GetPointer (out x, out y);
		Selected = HitTest (y);
	}
		private void HandleWidgetMotionNotifyEvent (object o, MotionNotifyEventArgs args)
		{
			X = args.Event.XRoot;
			Y = args.Event.YRoot;

			if (MotionNotifyEvent != null) {
				MotionNotifyEvent (this, new MouseButtonEventArgs ());
			}			
		}
Exemple #9
0
        private void HandleViewMotion(object sender, Gtk.MotionNotifyEventArgs args)
        {
            int x, y;

            Gdk.ModifierType type;
            ((Gtk.Widget)sender).GdkWindow.GetPointer(out x, out y, out type);
            controls.Visibility = ControlOverlay.VisibilityType.Partial;
            scroll.ShowControls();
        }
 public void ProcessMotionEvent(MotionNotifyEventArgs args)
 {
     if (swiping) {
         swipeTest = new Point((int) args.Event.X, (int) args.Event.Y);
         // Swipe must be horizontal or vertical
         if ((swipeTest.X - swipeStart.X > maxError || swipeTest.X - swipeStart.X < -maxError) && (swipeTest.Y - swipeStart.Y > maxError || swipeTest.Y - swipeStart.Y < -maxError)) {
             swiping = false;
         }
     }
 }
Exemple #11
0
 protected virtual void OnFixed1MotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     if (isDragged)
     {
         if (currCtrl != null)
         {
             MoveClone(ref currClone, args.Event.X, args.Event.Y);
         }
     }
 }
        void HandleMotionNotifyEvent(object o, MotionNotifyEventArgs args)
        {
            decorator.Clean();

            var doc = IdeApp.Workbench.ActiveDocument;
            if (doc == null || !IsCtrlPush(args.Event.State))
                return;

            decorator.Draw(doc, args.Event.X, args.Event.Y);

        }
Exemple #13
0
        void HandleValueTreeMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            if (mousePressed)
            {
                Watch.OffsetX += (int)(args.Event.XRoot - originX);
                Watch.OffsetY += (int)(args.Event.YRoot - originY);

                originX = args.Event.XRoot;
                originY = args.Event.YRoot;
            }
        }
Exemple #14
0
 protected virtual void OnMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     if (test_running)
     {
         Gdk.ModifierType state;
         Gdk.EventMotion  ev     = args.Event;
         Gdk.Window       window = ev.Window;
         test.StoreMousePosition(ev.X, ev.Y);
         args.RetVal = true;
     }
 }
Exemple #15
0
    /**
     * Invoked when mouse moves across window
     */
    protected void OnMainDrawingAreaMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
    {
        Gdk.EventMotion e = args.Event;

        if (transport.isConnected() && sessionClient.GetSessionId() != 0)
        {
            if (inputClient.Active)
            {
                inputClient.SendMouseMotionEvent((int)e.X, (int)e.Y);
            }
        }
    }
Exemple #16
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD new_pointd)
        {
            Point new_point = new Point((int)new_pointd.X, (int)new_pointd.Y);

            Document doc = PintaCore.Workspace.ActiveDocument;

            if (mouse_button <= 0)
            {
                last_point = point_empty;
                return;
            }

            if (last_point.Equals(point_empty))
            {
                last_point = new_point;
            }

            if (doc.Workspace.PointInCanvas(new_pointd))
            {
                surface_modified = true;
            }

            var surf = doc.CurrentUserLayer.Surface;

            using (Context g = new Context(surf)) {
                g.AppendPath(doc.Selection.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip();
                PointD last_pointd = new PointD(last_point.X, last_point.Y);

                if (eraser_type == EraserType.Normal)
                {
                    eraseNormal(g, last_pointd, new_pointd);
                }
                else if (eraser_type == EraserType.Smooth)
                {
                    eraseSmooth(surf, g, last_pointd, new_pointd);
                }
            }

            Gdk.Rectangle r = GetRectangleFromPoints(last_point, new_point);

            if (doc.Workspace.IsPartiallyOffscreen(r))
            {
                doc.Workspace.Invalidate();
            }
            else
            {
                doc.Workspace.Invalidate(doc.ClampToImageSize(r));
            }

            last_point = new_point;
        }
Exemple #17
0
        void HandleViewMotion(object sender, Gtk.MotionNotifyEventArgs args)
        {
            ShowCursor();
            //hide_cursor_delay.Restart ();

            ((Gtk.Widget)sender).GdkWindow.GetPointer(out var x, out var y, out var type);

            if (y > (Allocation.Height * 0.75))
            {
                controls.Visibility = ControlOverlay.VisibilityType.Partial;
                scroll.ShowControls();
            }
        }
Exemple #18
0
        protected virtual void OnDrawingareaMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            finalPoint = new Cairo.PointD(args.Event.X, args.Event.Y);

            if (selectedTool == DrawTool.PEN || selectedTool == DrawTool.ERASER)
            {
                using (Context c = new Context(drawings)) {
                    DrawLine(c, false, lastx, lasty, args.Event.X, args.Event.Y);
                }
                lastx = args.Event.X;
                lasty = args.Event.Y;
            }
            QueueDraw();
        }
Exemple #19
0
        protected override void OnMouseMove(object o, MotionNotifyEventArgs args, Cairo.PointD point)
        {
            if (!is_drawing)
                return;

            double x = Utility.Clamp (point.X, 0, PintaCore.Workspace.ImageSize.Width - 1);
            double y = Utility.Clamp (point.Y, 0, PintaCore.Workspace.ImageSize.Height - 1);

            PintaCore.Layers.ShowSelection = true;

            Rectangle dirty = DrawShape (PointsToRectangle (shape_origin, new PointD (x, y), (args.Event.State & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask), PintaCore.Layers.SelectionLayer);

            PintaCore.Workspace.Invalidate ();

            last_dirty = dirty;
        }
        protected virtual void OnDrawingareaMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            if (!hardGrab)
            {
                return;
            }

            if (lastx == -1 || lasty == -1)
            {
                lastx = args.Event.X;
                lasty = args.Event.Y;
            }
            DrawLine((int)lastx, (int)lasty, (int)args.Event.X, (int)args.Event.Y);
            lastx = args.Event.X;
            lasty = args.Event.Y;
        }
Exemple #21
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            if (!is_drawing)
            {
                return;
            }

            double x = Utility.Clamp(point.X, 0, doc.ImageSize.Width - 1);
            double y = Utility.Clamp(point.Y, 0, doc.ImageSize.Height - 1);

            doc.ShowSelection = true;

            ImageSurface surf = doc.SelectionLayer.Surface;

            using (Context g = new Context(surf)) {
                g.Antialias = Antialias.Subpixel;

                if (path != null)
                {
                    g.AppendPath(path);
                    (path as IDisposable).Dispose();
                }
                else
                {
                    g.MoveTo(x, y);
                }

                g.LineTo(x, y);
                lasso_polygon.Add(new IntPoint((long)x, (long)y));

                path = g.CopyPath();

                g.FillRule = FillRule.EvenOdd;
                g.ClosePath();

                doc.Selection.SelectionPath = g.CopyPath();
            }

            doc.Selection.SelectionPolygons.Clear();
            doc.Selection.SelectionPolygons.Add(lasso_polygon.ToList());
            SelectionModeHandler.PerformSelectionMode(combine_mode,
                                                      DocumentSelection.ConvertToPolygonSet(doc.Selection.SelectionPolygons));
            doc.Workspace.Invalidate();
        }
    protected void OnDaMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
    {
        if (!dragging)
        {
            return;
        }

        mousePosition = new Point((int)args.Event.X, (int)args.Event.Y);
        int width, height;

        da.GdkWindow.GetSize(out width, out height);

        if (mousePosition.X < 0 || mousePosition.Y < 0 ||
            mousePosition.X >= width || mousePosition.Y >= height)
        {
            return;
        }
    }
Exemple #23
0
        void HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            int cx, cy;

            Gtk.TreeIter iter;
            if (rendererTarget.GetCellPosition(CellRenderer, (int)args.Event.X, (int)args.Event.Y, out cx, out cy, out iter))
            {
                var rect = rendererTarget.GetCellBounds(target, CellRenderer, iter);

                if (rect.Contains(cx, cy))
                {
                    ApplicationContext.InvokeUserCode(delegate {
                        LoadData(rendererTarget.Model, iter);
                        EventSink.OnMouseMoved(new MouseMovedEventArgs(args.Event.Time, cx, cy));
                    });
                }
            }
        }
Exemple #24
0
        protected virtual void OnDrawingareaMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            Point point;

            if (!Sensitive)
            {
                return;
            }

            if (selectedCoords == null)
            {
                return;
            }
            point = new Point((int)args.Event.X, (int)args.Event.Y);
            TranslateToOriginCoords(point);
            selectedPoint.Y = point.Y;
            selectedPoint.X = point.X;
            QueueDraw();
        }
Exemple #25
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            Color tool_color;

            if ((args.Event.State & Gdk.ModifierType.Button1Mask) != 0)
            {
                tool_color = RandomColourPicker.PickRandom();
            }
            else if ((args.Event.State & Gdk.ModifierType.Button3Mask) != 0)
            {
                tool_color = RandomColourPicker.PickRandom();
            }
            else
            {
                last_point = point_empty;
                return;
            }

            Draw((DrawingArea)o, tool_color, point, false);
        }
Exemple #26
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            Color tool_color;

            if (mouse_button == 1)
            {
                tool_color = PintaCore.Palette.PrimaryColor;
            }
            else if (mouse_button == 3)
            {
                tool_color = PintaCore.Palette.SecondaryColor;
            }
            else
            {
                last_point = point_empty;
                return;
            }

            Draw((DrawingArea)o, tool_color, point, false);
        }
Exemple #27
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            Color tool_color;

            if ((args.Event.State & Gdk.ModifierType.Button1Mask) != 0)
            {
                tool_color = PintaCore.Palette.PrimaryColor;
            }
            else if ((args.Event.State & Gdk.ModifierType.Button3Mask) != 0)
            {
                tool_color = PintaCore.Palette.SecondaryColor;
            }
            else
            {
                last_point = point_empty;
                return;
            }

            Draw((DrawingArea)o, tool_color, point, false);
        }
Exemple #28
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            if (!is_drawing)
            {
                return;
            }

            double x = Utility.Clamp(point.X, 0, doc.ImageSize.Width - 1);
            double y = Utility.Clamp(point.Y, 0, doc.ImageSize.Height - 1);

            doc.ShowSelection = true;

            ImageSurface surf = doc.ToolLayer.Surface;

            using (Context g = new Context(surf)) {
                g.Antialias = Antialias.Subpixel;

                if (path != null)
                {
                    g.AppendPath(path);
                    (path as IDisposable).Dispose();
                }

                g.LineTo(x, y);

                path = g.CopyPath();

                g.FillRule = FillRule.EvenOdd;
                g.ClosePath();

                Path old = doc.SelectionPath;

                doc.SelectionPath = g.CopyPath();
                (old as IDisposable).Dispose();
            }

            doc.Workspace.Invalidate();
        }
Exemple #29
0
    protected void onDAMotionNotify(object o, MotionNotifyEventArgs args)
    {
        if (circuit == null)
            return;

        if (selectedTool == ToolType.LINK_CHK) {
            circuit.linkCheck(args.Event.X, args.Event.Y);
        }

        if (selectedTool == ToolType.DEL_M || selectedTool == ToolType.DEL_S) {
            clickCell(args.Event.X, args.Event.Y);
        }

        if (!linkingCells)
            return;

        switch (mouseButton) {

            case 1: // bouton 1

                switch (selectedTool) {
                    case ToolType.SILICON_N:
                        if (linkingCells)
                            clickCell(args.Event.X, args.Event.Y);
                        break;
                    case ToolType.SILICON_P:
                        if (linkingCells)
                            clickCell(args.Event.X, args.Event.Y);
                        break;
                    case ToolType.METAL:
                        if (linkingCells)
                            clickCell(args.Event.X, args.Event.Y);
                        break;
                }
                break;

        }
    }
Exemple #30
0
 void OnSizeMotion(object ob, Gtk.MotionNotifyEventArgs args)
 {
     if (resizing)
     {
         int newPos, n;
         if (horiz)
         {
             Toplevel.GetPointer(out newPos, out n);
             int diff    = startPos ? (newPos - resizePos) : (resizePos - newPos);
             int newSize = origSize + diff;
             if (newSize < Child.SizeRequest().Width)
             {
                 newSize = Child.SizeRequest().Width;
             }
             if (!startPos)
             {
                 X = origPos - newSize;
             }
             WidthRequest = newSize;
         }
         else
         {
             Toplevel.GetPointer(out n, out newPos);
             int diff    = startPos ? (newPos - resizePos) : (resizePos - newPos);
             int newSize = origSize + diff;
             if (newSize < Child.SizeRequest().Height)
             {
                 newSize = Child.SizeRequest().Height;
             }
             if (!startPos)
             {
                 Y = origPos - newSize;
             }
             HeightRequest = newSize;
         }
         frame.QueueResize();
     }
 }
		void HandleMotionNotifyEvent (object sender, MotionNotifyEventArgs args)
		{
			var document = IdeApp.Workbench.ActiveDocument;

			if (IdeApp.Workspace == null) return;
			if (document == null) return;
			if (document.ParsedDocument == null) return;

			try
			{
				if (_marker != null) 
				{
					RemoveMarker (document.Editor.Document);
				}
				
				if ((args.Event.State & ModifierType.ControlMask) == ModifierType.ControlMask)
				{
					DocumentLocation location = document.Editor.Parent.PointToLocation(args.Event.X - document.Editor.Parent.TextViewMargin.XOffset, args.Event.Y);
					
					int offset = document.Editor.LocationToOffset(location);
					int start = document.Editor.FindCurrentWordStart(offset);
					int end = document.Editor.FindCurrentWordEnd(offset);
					
					if (end - start <= 0) return;
					
					_marker = new UnderlineTextSegmentMarker(document.Editor.ColorStyle.KeywordNamespace.Foreground, new TextSegment(start, end - start));
					_marker.Wave = false;
					_marker.IsVisible = true;
					document.Editor.Document.AddMarker(_marker);
					document.Editor.Parent.QueueDraw();
				}
			}
			catch (Exception exception)
			{
				LoggingService.LogError(exception.ToString());
			}
		}
Exemple #32
0
        //event for when we are creating our rectangle of cropness
        void Dragging(object sender, Gtk.MotionNotifyEventArgs args)
        {
            toCropBox.GdkWindow.Clear();

            //draw horizontal lines
            toCropBox.GdkWindow.DrawLine(toCropBox.Style.BaseGC(StateType.Normal), mouseStart.X, mouseStart.Y, topRightCoords.X, topRightCoords.Y);
            toCropBox.GdkWindow.DrawLine(toCropBox.Style.BaseGC(StateType.Normal), bottomLeftCoords.X, bottomLeftCoords.Y, mouseEnd.X, mouseEnd.Y);

            //draw vertical lines
            toCropBox.GdkWindow.DrawLine(toCropBox.Style.BaseGC(StateType.Normal), mouseStart.X, mouseStart.Y, bottomLeftCoords.X, bottomLeftCoords.Y);
            toCropBox.GdkWindow.DrawLine(toCropBox.Style.BaseGC(StateType.Normal), topRightCoords.X, topRightCoords.Y, mouseEnd.X, mouseEnd.Y);

            //set our new coords
            mouseEnd         = new Gdk.Point((int)Math.Floor(args.Event.X), (int)Math.Floor(args.Event.Y));
            topRightCoords   = new Gdk.Point(mouseEnd.X, mouseStart.Y);
            bottomLeftCoords = new Gdk.Point(mouseStart.X, mouseEnd.Y);

            Console.WriteLine("-------------------------------------");
            Console.WriteLine("Mouse Moved");
            Console.WriteLine("Mouse End Point: ({0}, {1})", mouseEnd.X, mouseEnd.Y);
            Console.WriteLine("Top Right Point: ({0}, {1})", topRightCoords.X, topRightCoords.Y);
            Console.WriteLine("Bottom Left Point: ({0}, {1})", bottomLeftCoords.X, bottomLeftCoords.Y);
            Console.WriteLine("-------------------------------------");
        }
Exemple #33
0
        void HandleMotionNotifyEvent(object sender, MotionNotifyEventArgs args)
        {
            pos.X = (int) args.Event.XRoot - start.X;
                pos.Y = (int) args.Event.YRoot - start.Y;

            root_pos.X = (int) args.Event.XRoot;
            root_pos.Y = (int) args.Event.YRoot;

            if (dragging)
                drag.Start ();
        }
Exemple #34
0
        protected void OnEventVolumeMotionNotifyEvent(object o, MotionNotifyEventArgs args)
        {
            int width;
            int height;
            drawVolume.GdkWindow.GetSize(out width, out height);

            int x = (int) args.Event.X;
            int startInside = 36;
            int endInside = width - 36;

            if (x < startInside) {
                Percentage = 0;
            } else if (x > endInside) {
                Percentage = 100;
            } else {
                Percentage = (x - startInside) * 100 / (endInside - startInside);
            }

            QueueDraw();
        }
Exemple #35
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            if (mouse_button <= 0)
            {
                last_point = point_empty;
                return;
            }

            int x = (int)point.X;
            int y = (int)point.Y;

            if (last_point.Equals(point_empty))
            {
                last_point = new Point(x, y);
            }

            if (doc.Workspace.PointInCanvas(point))
            {
                surface_modified = true;
            }

            ImageSurface surf = doc.CurrentLayer.Surface;

            using (Context g = new Context(surf)) {
                g.AppendPath(doc.Selection.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip();

                g.Antialias = UseAntialiasing ? Antialias.Subpixel : Antialias.None;

                // Adding 0.5 forces cairo into the correct square:
                // See https://bugs.launchpad.net/bugs/672232
                g.MoveTo(last_point.X + 0.5, last_point.Y + 0.5);
                g.LineTo(x + 0.5, y + 0.5);

                // Right-click is erase to background color, left-click is transparent
                if (mouse_button == 3)
                {
                    g.Color = PintaCore.Palette.SecondaryColor;
                }
                else
                {
                    g.Operator = Operator.Clear;
                }

                g.LineWidth = BrushWidth;
                g.LineJoin  = LineJoin.Round;
                g.LineCap   = LineCap.Round;

                g.Stroke();
            }

            Gdk.Rectangle r = GetRectangleFromPoints(last_point, new Point(x, y));

            if (doc.Workspace.IsPartiallyOffscreen(r))
            {
                doc.Workspace.Invalidate();
            }
            else
            {
                doc.Workspace.Invalidate(r);
            }

            last_point = new Point(x, y);
        }
Exemple #36
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            if (mouse_button == 1)
            {
                stroke_color = PintaCore.Palette.PrimaryColor;
            }
            else if (mouse_button == 3)
            {
                stroke_color = PintaCore.Palette.SecondaryColor;
            }
            else
            {
                last_point = point_empty;
                return;
            }

            // TODO: also multiply by pressure
            stroke_color = new Color(stroke_color.R, stroke_color.G, stroke_color.B,
                                     stroke_color.A * active_brush.StrokeAlphaMultiplier);

            int x = (int)point.X;
            int y = (int)point.Y;

            if (last_point.Equals(point_empty))
            {
                last_point = new Point(x, y);
            }

            if (doc.Workspace.PointInCanvas(point))
            {
                surface_modified = true;
            }

            var surf            = doc.CurrentUserLayer.Surface;
            var invalidate_rect = Gdk.Rectangle.Zero;
            var brush_width     = BrushWidth;//nlook width change of brush + x/10;

            using (var g = new Context(surf)) {
                g.AppendPath(doc.Selection.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip();

                g.Antialias = UseAntialiasing ? Antialias.Subpixel : Antialias.None;
                g.LineWidth = brush_width;
                g.LineJoin  = LineJoin.Round;
                g.LineCap   = BrushWidth == 1 ? LineCap.Butt : LineCap.Round;
                g.SetSourceColor(stroke_color);

                invalidate_rect = active_brush.DoMouseMove(g, stroke_color, surf,
                                                           x, y, last_point.X, last_point.Y);
            }

            // If we draw partially offscreen, Cairo gives us a bogus
            // dirty rectangle, so redraw everything.
            if (doc.Workspace.IsPartiallyOffscreen(invalidate_rect))
            {
                doc.Workspace.Invalidate();
            }
            else
            {
                doc.Workspace.Invalidate(doc.ClampToImageSize(invalidate_rect));
            }

            last_point = new Point(x, y);
        }
Exemple #37
0
        protected unsafe override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            ColorBgra old_color;
            ColorBgra new_color;

            if (mouse_button == 1)
            {
                old_color = PintaCore.Palette.PrimaryColor.ToColorBgra();
                new_color = PintaCore.Palette.SecondaryColor.ToColorBgra();
            }
            else if (mouse_button == 3)
            {
                old_color = PintaCore.Palette.SecondaryColor.ToColorBgra();
                new_color = PintaCore.Palette.PrimaryColor.ToColorBgra();
            }
            else
            {
                last_point = point_empty;
                return;
            }

            int x = (int)point.X;
            int y = (int)point.Y;

            if (last_point.Equals(point_empty))
            {
                last_point = new Point(x, y);
            }

            if (doc.Workspace.PointInCanvas(point))
            {
                surface_modified = true;
            }

            ImageSurface surf      = doc.CurrentUserLayer.Surface;
            ImageSurface tmp_layer = doc.ToolLayer.Surface;

            Gdk.Rectangle roi = GetRectangleFromPoints(last_point, new Point(x, y));

            roi         = PintaCore.Workspace.ClampToImageSize(roi);
            myTolerance = (int)(Tolerance * 256);

            tmp_layer.Flush();

            ColorBgra *tmp_data_ptr  = (ColorBgra *)tmp_layer.DataPtr;
            int        tmp_width     = tmp_layer.Width;
            ColorBgra *surf_data_ptr = (ColorBgra *)surf.DataPtr;
            int        surf_width    = surf.Width;

            // The stencil lets us know if we've already checked this
            // pixel, providing a nice perf boost
            // Maybe this should be changed to a BitVector2DSurfaceAdapter?
            for (int i = roi.X; i <= roi.GetRight(); i++)
            {
                for (int j = roi.Y; j <= roi.GetBottom(); j++)
                {
                    if (stencil[i, j])
                    {
                        continue;
                    }

                    if (IsColorInTolerance(new_color, surf.GetColorBgraUnchecked(surf_data_ptr, surf_width, i, j)))
                    {
                        *tmp_layer.GetPointAddressUnchecked(tmp_data_ptr, tmp_width, i, j) = AdjustColorDifference(new_color, old_color, surf.GetColorBgraUnchecked(surf_data_ptr, surf_width, i, j));
                    }

                    stencil[i, j] = true;
                }
            }

            tmp_layer.MarkDirty();

            using (Context g = new Context(surf)) {
                g.AppendPath(doc.Selection.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip();

                g.Antialias = UseAntialiasing ? Antialias.Subpixel : Antialias.None;

                g.MoveTo(last_point.X, last_point.Y);
                g.LineTo(x, y);

                g.LineWidth = BrushWidth;
                g.LineJoin  = LineJoin.Round;
                g.LineCap   = LineCap.Round;

                g.SetSource(tmp_layer);

                g.Stroke();
            }

            doc.Workspace.Invalidate(roi);

            last_point = new Point(x, y);
        }
Exemple #38
0
 protected void OnTreeviewMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     UpdateTipWindow((int)args.Event.X, (int)args.Event.Y);
 }
Exemple #39
0
 void OnMotionNotify(object o, MotionNotifyEventArgs args)
 {
     OnMove((o as Preview).GetXY(args));
 }
        protected void OnPointerMotion(object o, MotionNotifyEventArgs args)
        {
            mouseCoords = ScreenToWorld (new PointD(args.Event.X, args.Event.Y));
            if (Mode == PlanViewMode.Add) {
                drawingarea1.QueueDraw ();
            }
            if (floor != null) {
                //this.HasTooltip = false;
                bool hasTooltip=false;
                Reserve hightlightedReserve = null;
                foreach (Polygon polygon in currentFloorPolygons) {
                    if (polygon.Contains(mouseCoords))
                        hightlightedReserve = reserves.SingleOrDefault(r=>r.Places.Any(p=>p.Id==polygon.Place.Id));
                }
                foreach (Polygon polygon in currentFloorPolygons) {
                    if (polygon.Id == editPolygon.Id) {
                        editPolygon.Hightlighted = true;
                    } else {
                        bool containsPointer = polygon.Contains (mouseCoords);
                        bool highlighted = containsPointer || (reserves.SingleOrDefault(r=>r.Places.Any(p=>p.Id==polygon.Place.Id)) == hightlightedReserve && hightlightedReserve!=null);
                        if (highlighted ^ polygon.Hightlighted) {
                            drawingarea1.QueueDraw ();
                            polygon.Hightlighted = highlighted;
                        }
                        if (containsPointer) {
                            PolygonAtPointer = polygon;
                            hasTooltip = true;
                        }
                    }
                }
                if (isDraggingVertex) {
                    editPolygon.Vertices [selectedVertexIndex] = mouseCoords;
                    drawingarea1.QueueDraw ();
                }
                if (this.HasTooltip ^ hasTooltip)
                    this.HasTooltip = hasTooltip;
                if (!this.HasTooltip)
                    TooltipText = "";
            }

            if (isDragging) {
                scrollAdjX.Value = MathHelper.Clamp (dragStartScrollX + (dragStartX - args.Event.X),scrollAdjX.Lower,scrollAdjX.Upper-scrollAdjX.PageSize);
                scrollAdjY.Value = MathHelper.Clamp (dragStartScrollY + (dragStartY - args.Event.Y),scrollAdjY.Lower,scrollAdjY.Upper-scrollAdjY.PageSize);
            }
        }
		void OnMotionNotify (object obj, MotionNotifyEventArgs args) {

			if (!DragInProgress) {
				DragInProgress = true;
				Grab.Add (this);

				if (!Pointer.IsGrabbed)
					Pointer.Grab (ParentWindow, false, EventMask.Button1MotionMask | EventMask.ButtonReleaseMask, null, fleurCursor, args.Event.Time);	
			}

			MoveTab (FindTabAtPosition (args.Event.XRoot, args.Event.YRoot));
		}
 private void OnDrawingAreaMotionNotify(object i, MotionNotifyEventArgs e)
 {
     if(!selecting)
         return;
     select((int) e.Event.X, (int) e.Event.Y);
 }
Exemple #43
0
		static void HandleMotionNotifyEvent(object o, MotionNotifyEventArgs args)
		{
			TreeView tree = (TreeView) o;
			TreeViewTooltipsData data;
			if (!treeData.TryGetValue (tree, out data))
				return;

			HideTooltip (tree);

			int cx, cy;
			TreePath path;
			TreeViewColumn col;
			if (!tree.GetPathAtPos ((int)args.Event.X, (int)args.Event.Y, out path, out col, out cx, out cy))
				return;
			data.Path = path;
			data.ShowTimer = GLib.Timeout.Add (300, delegate {
				data.ShowTimer = 0;
				int ox, oy;
				tree.BinWindow.GetOrigin (out ox, out oy);
				Gdk.Rectangle rect = tree.GetCellArea (path, col);
				data.Tooltip = new CellTooltipWindow (tree, col, path);
				if (rect.X + data.Tooltip.SizeRequest ().Width > tree.Allocation.Width) {
					data.Tooltip.Move (ox + rect.X - 1, oy + rect.Y);
					data.Tooltip.ShowAll ();
				} else {
					data.Tooltip.Destroy ();
					data.Tooltip = null;
				}
				return false;
			});
		}
Exemple #44
0
        void HandleImageViewMotion(object sender, MotionNotifyEventArgs args)
        {
            Gdk.Point coords;
            coords = new Gdk.Point ((int) args.Event.X, (int) args.Event.Y);

            SetSamplePoint (view.WindowCoordsToImage (coords));
        }
		void HandleTreeMotionNotifyEvent (object o, MotionNotifyEventArgs args)
		{
			PlacePinWindow ();
		}
Exemple #46
0
        protected void OnMoveMouse(object o, MotionNotifyEventArgs args)
        {
            int x,y;
            Gdk.ModifierType state;
            args.Event.Window.GetPointer(out x, out y, out state);

            int nextHoveringIndex;
            if (x >= 0 && y >= 0 && x<Width*TileWidth*Scale && y<Height*TileHeight*Scale) {
                nextHoveringIndex = (x/TileWidth/Scale) + (y/TileHeight/Scale)*Width;
            }
            else {
                nextHoveringIndex = -1;
            }

            if (nextHoveringIndex != hoveringIndex) {
                this.QueueDrawArea(HoveringX*TileWidth*Scale, HoveringY*TileHeight*Scale,
                        TileWidth*Scale, TileHeight*Scale);
                hoveringIndex = nextHoveringIndex;
                this.QueueDrawArea(HoveringX*TileWidth*Scale, HoveringY*TileHeight*Scale,
                        TileWidth*Scale, TileHeight*Scale);

                if (HoverChangedEvent != null)
                    HoverChangedEvent();
            }
        }
    private void OnMotionNotify(object o, MotionNotifyEventArgs args)
    {
        if(tilegroup == null)
            return;

        Vector MousePos = new Vector((float) args.Event.X,
                                     (float) args.Event.Y);
        int newtile = PosToTile(MousePos);
        if(newtile != hovertile) {
            if( multiselectInProgress ){
                MultiSelect( MousePos, StartPos );
            } else {
                QueueDraw();
            }
        }
        hovertile = newtile;
    }
		void HandleMotionNotifyEvent(object o, MotionNotifyEventArgs args)
		{
			TreeIter iter;
				
				if (!elementsTreeview.Selection.GetSelected (out iter))
					return;
				Gdk.Rectangle rect = elementsTreeview.GetCellArea (elementsStore.GetPath (iter), elementsTreeview.GetColumn (0));
				int x, y;
				this.GdkWindow.GetOrigin (out x, out y);
				x += rect.X;
				y += rect.Y;
				if (this.tooltipWindow == null || ox != x || oy != y) {
					ShowTooltipForSelectedEntry ();
					ox = x;
					oy = y;
				}
		}
Exemple #49
0
 void HeaderMotion(object ob, Gtk.MotionNotifyEventArgs args)
 {
     frame.UpdatePlaceholder(item, Allocation.Size, allowPlaceholderDocking);
 }
Exemple #50
0
		private void MotionNotifyEventCb (object obj, MotionNotifyEventArgs args)
		{
			_canvas.WorldToWindow (args.Event.X, args.Event.Y, out _pointer_x, out _pointer_y); 
			if (_cp_motioned != null && _umledge != null)
			{
				_cp_motioned.ForceMove (_pointer_x, _pointer_y);
			}
			if (_dragging_association)
			{
				//this prevents bad behavior when window is resized
				//TODO: create an association 
//				_current_edge.DisplayEdge(_pointer_x, _pointer_y);
			}
			else if (_is_nodeentry_moved == false)
			{
				//this prevents bad behavior when window is resized
				_selector.DrawSelection (_pointer_x, _pointer_y);
			}
		}
Exemple #51
0
	void MotionHandler (object o, MotionNotifyEventArgs args)
	{
		Gdk.EventMotion pos = args.Event;
		int pixc = (int) pos.X % cell_width;
		int pixr = (int) pos.Y % cell_height;

		mouse_col = (int) pos.X / cell_width;
		mouse_row = top_row * visible_cols + (int) pos.Y / cell_height;
		
		if (((pixc > x_margin && pixc < (cell_width - x_margin)) &&
		     (pixr > y_margin && pixr < (cell_height - y_margin))))
			highlight_mouse = true;
		else
			highlight_mouse = false;

		//Console.WriteLine ("File: " + ((DirectoryProvider) provider).images [ItemAt (mouse_col, mouse_row)].File);
		//DrawCell (mouse_col, mouse_row);
	}
Exemple #52
0
 public void DoMouseMove(object o, MotionNotifyEventArgs args, Cairo.PointD point)
 {
     OnMouseMove (o, args, point);
 }
Exemple #53
0
 public void DoMouseMove(object o, MotionNotifyEventArgs args, Cairo.PointD point)
 {
     if (MouseMoved != null)
         MouseMoved (point.X, point.Y, args.Event.State);
     OnMouseMove (o, args, point);
 }
        private void HandleMotionNotifyEvent(object sender, MotionNotifyEventArgs args)
        {
            if (!this.CanApplyMarker()) return;

            this.RemoveMarker();

            if ((args.Event.State & ModifierType.Mod1Mask) == ModifierType.Mod1Mask)
            {
                var document = IdeApp.Workbench.ActiveDocument;
                var location = document.Editor.Parent.PointToLocation(args.Event.X - document.Editor.Parent.TextViewMargin.XOffset, args.Event.Y);

                int offset = document.Editor.LocationToOffset(location);
                int start = document.Editor.FindCurrentWordStart(offset);
                int end = document.Editor.FindCurrentWordEnd(offset);

                if (end - start <= 0) return;

                var element = this.GetCurrentElement(document, offset);
                if (element != null)
                {
                    this.PlaceMarker(document, start, end);
                }
                else
                {
                    var variable = this.GetCurrentVariable(document, offset);
                    if (variable != null)
                    {
                        this.PlaceMarker(document, start, end);
                    }
                }
            }
        }
Exemple #55
0
		static void MotionNotifyEvent (object obj, MotionNotifyEventArgs args)
		{
			int x, y;
			Gdk.ModifierType state;
			Gdk.EventMotion ev = args.Event;
			Gdk.Window window = ev.Window;

			if (ev.IsHint) {
				Gdk.ModifierType s;
				window.GetPointer (out x, out y, out s);
				state = s;
			} else {
				x = (int) ev.X;
				y = (int) ev.Y;
				state = ev.State;
			}

			if ((state & Gdk.ModifierType.Button1Mask) != 0 && pixmap != null)
				DrawBrush (x, y, true);
			else if ((state & Gdk.ModifierType.Button3Mask) != 0 && pixmap != null)
				DrawBrush (x, y, false);

			args.RetVal = true;
		}
Exemple #56
0
        protected override void OnMouseMove(object o, MotionNotifyEventArgs args, Cairo.PointD point)
        {
            ctrlKey = (args.Event.State & ModifierType.ControlMask) != 0;

            lastMousePosition = point.ToGdkPoint();

            // If we're dragging the text around, do that
            if (tracking)
            {
                Cairo.PointD delta = new Cairo.PointD(point.X - startMouseXY.X, point.Y - startMouseXY.Y);

                clickPoint = new Point((int)(startClickPoint.X + delta.X), (int)(startClickPoint.Y + delta.Y));
                CurrentTextEngine.Origin = clickPoint;

                RedrawText(true, true);
            }
            else
            {
                UpdateMouseCursor();
            }
        }
 void DrawMotionNotifyEvent(object o, MotionNotifyEventArgs args)
 {
     if (this.Sensitive && MouseClick != null && _button != MouseButton.None) {
         MouseClick (this, new MouseEventArgs ((int)args.Event.X, (int)args.Event.Y, _button));
     }
 }
Exemple #58
0
 protected override MouseMovedEventArgs GetMouseMovedEventArgs(MotionNotifyEventArgs args)
 {
     int x, y;
     Widget.ConvertBinWindowToWidgetCoords ((int)args.Event.X, (int)args.Event.Y, out x, out y);
     return new MouseMovedEventArgs ((long) args.Event.Time, x, y);
 }
Exemple #59
0
        private void OnMotionNotifyEvent(object sender, MotionNotifyEventArgs a)
        {
            Gdk.EventMotion ev = a.Event;

            //if ((ev.State & Gdk.ModifierType.Button1Mask) != 0) {
            if (button1Pressed) {
                mouseMode = GLWidget.MouseOpMode.Drag;
                GdkWindow.Cursor = cursorDrag;
            } else {
                mouseMode = GLWidget.MouseOpMode.None;
                GdkWindow.Cursor = cursorCross;
            }

            /*
            testX = (float) (ev.X - width / 2f) / width *2f ;
            testY = (float) -(ev.Y - height/ 2f) / height*2f ;
            Console.WriteLine("state: "+ev.State.ToString());
            */

            switch (mouseMode) {
                case MouseOpMode.Drag:

                    int ix, iy;
                    double x, y;

                    Gdk.ModifierType m;

                    // Find the current mouse X and Y positions
                    if (ev.IsHint) {
                        ev.Window.GetPointer (out ix, out iy, out m);
                        x = (double)ix;
                        y = (double)iy;
                    } else {
                        x = ev.X;
                        y = ev.Y;
                    }

                    cameraAngleX += (float)(x - beginX);
                    cameraAngleY += (float)(y - beginY);
                    // Reset the "old" X and Y positions
                    beginX = x;
                    beginY = y;
                    break;
            }
            mX = ev.X;
            mY = ev.Y;
            Redraw ();
        }
		// Update the cursor image if the pointer moved.
		void MotionNotify (object sender, MotionNotifyEventArgs args)
		{
			TextView view = sender as TextView;
			int x, y;
			Gdk.ModifierType state;

			view.WindowToBufferCoords (TextWindowType.Widget, (int) args.Event.X, (int) args.Event.Y, out x, out y);
			SetCursorIfAppropriate (view, x, y);

			view.Window.GetPointer (out x, out y, out state);
		}