Beispiel #1
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();
            }
        }
Beispiel #2
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            if (button_down == 0)
            {
                return;
            }

            if (!doc.Workspace.PointInCanvas(point))
            {
                return;
            }

            var color = GetColorFromPoint(point);

            if (button_down == 1)
            {
                PintaCore.Palette.PrimaryColor = color;
            }
            else if (button_down == 3)
            {
                PintaCore.Palette.SecondaryColor = color;
            }
        }
Beispiel #3
0
        private void HandleDrawingMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            int x, y;

            Gdk.ModifierType mask;
            drawing.GdkWindow.GetPointer(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();
        }
Beispiel #4
0
 void GMapWidget_MotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     if (addressMoving)
     {
         addressMarker.Position = gMapWidget.FromLocalToLatLng((int)args.Event.X, (int)args.Event.Y);
     }
 }
Beispiel #5
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            if (!is_dragging)
            {
                return;
            }

            Document doc = PintaCore.Workspace.ActiveDocument;

            PointD new_offset = point;

            double dx = origin_offset.X - new_offset.X;
            double dy = origin_offset.Y - new_offset.Y;

            using (Cairo.Context g = new Cairo.Context(doc.CurrentLayer.Surface)) {
                Path old = doc.SelectionPath;
                g.FillRule = FillRule.EvenOdd;
                g.AppendPath(doc.SelectionPath);
                g.Translate(dx, dy);
                doc.SelectionPath = g.CopyPath();
                (old as IDisposable).Dispose();
            }

            origin_offset     = new_offset;
            doc.ShowSelection = true;

            (o as Gtk.DrawingArea).GdkWindow.Invalidate();
        }
Beispiel #6
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            if (!is_dragging)
            {
                return;
            }

            Document doc = PintaCore.Workspace.ActiveDocument;

            PointD new_offset = new PointD(point.X, point.Y);

            double dx = origin_offset.X - new_offset.X;
            double dy = origin_offset.Y - new_offset.Y;

            Path path = doc.SelectionPath;

            using (Cairo.Context g = new Cairo.Context(doc.CurrentLayer.Surface)) {
                g.AppendPath(path);
                g.Translate(dx, dy);
                doc.SelectionPath = g.CopyPath();
            }

            (path as IDisposable).Dispose();

            doc.SelectionLayer.Offset = new PointD(doc.SelectionLayer.Offset.X - dx, doc.SelectionLayer.Offset.Y - dy);

            origin_offset = new_offset;

            (o as Gtk.DrawingArea).GdkWindow.Invalidate();
        }
Beispiel #7
0
        void GmapWidget_MotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            if (gmapWidget.IsMouseOverRoute)
            {
                GPoint tl      = new GPoint((long)args.Event.X - 4, (long)args.Event.Y - 4);
                var    TLPoint = gmapWidget.FromLocalToLatLng(tl);
                GPoint br      = new GPoint((long)args.Event.X + 4, (long)args.Event.Y + 4);
                var    BRPoint = gmapWidget.FromLocalToLatLng(br);

                GPoint mouse    = new GPoint((long)args.Event.X, (long)args.Event.Y);
                var    geopoint = gmapWidget.FromLocalToLatLng(mouse);

                var rect = RectLatLng.FromLTRB(TLPoint.Lng, TLPoint.Lat, BRPoint.Lng, BRPoint.Lat);

                var nearest = track.TrackPoints
                              .Where(x => rect.Contains(x.Latitude, x.Longitude))
                              .OrderBy(x => GMapProviders.EmptyProvider.Projection.GetDistance(geopoint, new PointLatLng(x.Latitude, x.Longitude)))
                              .FirstOrDefault();
                if (nearest != null)
                {
                    ylabelPoint.LabelProp = String.Format("(ш.{0:F6} д.{1:F6}) - {2:T}", nearest.Latitude, nearest.Longitude, nearest.TimeStamp);
                }
                else
                {
                    ylabelPoint.LabelProp = String.Empty;
                }
            }
            else
            {
                ylabelPoint.LabelProp = String.Empty;
            }
        }
Beispiel #8
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            if (button_down == 0)
            {
                return;
            }

            if (!doc.Workspace.PointInCanvas(point))
            {
                return;
            }

            Color color = doc.CurrentLayer.Surface.GetPixel((int)point.X, (int)point.Y);

            if (button_down == 1)
            {
                PintaCore.Palette.PrimaryColor = color;
            }
            else if (button_down == 3)
            {
                PintaCore.Palette.SecondaryColor = color;
            }
        }
Beispiel #9
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            if (!is_drawing)
            {
                return;
            }

            Document doc = PintaCore.Workspace.ActiveDocument;

            current_point = point;
            double x = point.X;
            double y = point.Y;

            doc.ToolLayer.Clear();

            bool      shiftkey_pressed = (args.Event.State & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask;
            Rectangle dirty            = DrawShape(Utility.PointsToRectangle(shape_origin, new PointD(x, y), shiftkey_pressed), doc.ToolLayer, shiftkey_pressed);

            dirty = dirty.Clamp();

            doc.Workspace.Invalidate(last_dirty.ToGdkRectangle());
            doc.Workspace.Invalidate(dirty.ToGdkRectangle());

            last_dirty = dirty;

            if (doc.Workspace.PointInCanvas(point))
            {
                surface_modified = true;
            }
        }
Beispiel #10
0
 private void HandleHandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     if (tracking)
     {
         Position = MousePtToPosition(new Cairo.PointD(args.Event.X, args.Event.Y));
     }
 }
Beispiel #11
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
        {
            if (!is_drawing)
            {
                return;
            }

            Document doc = PintaCore.Workspace.ActiveDocument;

            current_point = point;
            double x = point.X;
            double y = point.Y;

            doc.ToolLayer.Clear();

            Rectangle dirty = DrawShape(Utility.PointsToRectangle(shape_origin, new PointD(x, y), args.Event.State.IsShiftPressed()), doc.ToolLayer);

            // Increase the size of the dirty rect to account for antialiasing.
            if (UseAntialiasing)
            {
                dirty = dirty.Inflate(1, 1);
            }

            dirty = dirty.Clamp();

            doc.Workspace.Invalidate(last_dirty.ToGdkRectangle());
            doc.Workspace.Invalidate(dirty.ToGdkRectangle());

            last_dirty = dirty;

            if (doc.Workspace.PointInCanvas(point))
            {
                surface_modified = true;
            }
        }
Beispiel #12
0
 void HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     if (CurrentSelectedTextMarker == null)
     {
         DestroyPopoverWindow();
     }
 }
Beispiel #13
0
        void HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            var a = new MouseMovedEventArgs((long)args.Event.Time, args.Event.X, args.Event.Y);

            Toolkit.Invoke(delegate {
                EventSink.OnMouseMoved(a);
            });
        }
Beispiel #14
0
            public void HandleMotionNotifyEvent(System.Object o, Gtk.MotionNotifyEventArgs args)
            {
                var          p         = new PointF((float)args.Event.X, (float)args.Event.Y);
                Key          modifiers = args.Event.State.ToEtoKey();
                MouseButtons buttons   = args.Event.State.ToEtoMouseButtons();

                Handler.Widget.OnMouseMove(new MouseEventArgs(buttons, modifiers, p));
            }
Beispiel #15
0
        void HandleWidgetMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            var a = new MouseMovedEventArgs();

            a.X = args.Event.X;
            a.Y = args.Event.Y;
            EventSink.OnMouseMoved(a);
        }
Beispiel #16
0
 private void eventboxTitle_HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     // move
     if (MovingHelper.IsMoving)
     {
         MovingHelper.Move();
     }
 }
Beispiel #17
0
 bool ISmartTagMarker.IsInsideWindow(Gtk.MotionNotifyEventArgs args)
 {
     if (editor == null)
     {
         return(false);
     }
     return(args.Event.Window == editor.TextArea.GdkWindow);
 }
Beispiel #18
0
 void OnMotionNotify(object ob, Gtk.MotionNotifyEventArgs args)
 {
     if (motionDrag)
     {
         // Looks like drag begin can be intercepted, so the motion notify
         // has to be used.
         ProcessDragBegin(null, args.Event);
         motionDrag = false;
     }
 }
Beispiel #19
0
        void FlowsheetSurface_GTK_MotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            float x = (int)args.Event.X;
            float y = (int)args.Event.Y;

            _lastTouchX = x;
            _lastTouchY = y;
            fsurface.InputMove((int)_lastTouchX, (int)_lastTouchY);
            this.QueueDraw();
        }
Beispiel #20
0
        protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, PointD point)
        {
            if (active)
            {
                Document doc = PintaCore.Workspace.ActiveDocument;

                doc.Workspace.ScrollCanvas((int)(last_point.X - args.Event.XRoot), (int)(last_point.Y - args.Event.YRoot));
                last_point = new PointD(args.Event.XRoot, args.Event.YRoot);
            }
        }
Beispiel #21
0
        void HandleWidgetMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            var a = new MouseMovedEventArgs();

            a.X = args.Event.X;
            a.Y = args.Event.Y;
            Toolkit.Invoke(delegate {
                EventSink.OnMouseMoved(a);
            });
        }
Beispiel #22
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;
            }
        }
Beispiel #23
0
        private void GtkControlObject_MotionNotifyEvent(System.Object o, Gtk.MotionNotifyEventArgs args)
        {
            Point        p         = new Point(Convert.ToInt32(args.Event.X), Convert.ToInt32(args.Event.Y));
            Key          modifiers = GetKeyModifiers(args.Event.State);
            MouseButtons buttons   = GetButtonModifiers(args.Event.State);

            Widget.OnMouseMove(new MouseEventArgs(buttons, modifiers, p));

            /*int x,y;
             * GtkControlObject.GetPointer(out x, out y);
             * p = new Point(x, y);*/
        }
Beispiel #24
0
 void HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
 {
     if (isMouseSelection)
     {
         if (cacheSelectionStart != SelectionStart || cacheSelectionLength != SelectionLength)
         {
             HandleSelectionChanged();
         }
     }
     cacheSelectionStart  = SelectionStart;
     cacheSelectionLength = SelectionLength;
 }
Beispiel #25
0
        void OnMouseMove(object sender, Gtk.MotionNotifyEventArgs e)
        {
            if (_popup.IsVisible)
            {
                Point mousePt = new Point(e.Event.X, e.Event.Y); //TODO: Check if we have to move to screen cordinate system

                if (this.ShouldClearToolTipOnMouseMove(mousePt))
                {
                    _manager.RemoveAgent(this);
                }
            }
        }
Beispiel #26
0
        void HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            var a = new MouseMovedEventArgs((long)args.Event.Time, args.Event.X, args.Event.Y);

            ApplicationContext.InvokeUserCode(delegate {
                EventSink.OnMouseMoved(a);
            });
            if (a.Handled)
            {
                args.RetVal = true;
            }
        }
Beispiel #27
0
        private void GtkControlObject_MotionNotifyEvent(System.Object o, Gtk.MotionNotifyEventArgs args)
        {
            var          p         = new PointF((float)args.Event.X, (float)args.Event.Y);
            Key          modifiers = args.Event.State.ToEtoKey();
            MouseButtons buttons   = args.Event.State.ToEtoMouseButtons();

            Widget.OnMouseMove(new MouseEventArgs(buttons, modifiers, p));

            /*int x,y;
             * GtkControlObject.GetPointer(out x, out y);
             * p = new Point(x, y);*/
        }
Beispiel #28
0
        void HandleIconViewMotion(object sender, Gtk.MotionNotifyEventArgs args)
        {
            if (!Visible)
            {
                return;
            }

            int x = (int)args.Event.X;
            int y = (int)args.Event.Y;

            view.GrabFocus();
            UpdateItem(x, y);
        }
Beispiel #29
0
        void HandleMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
        {
            var sc = ConvertToScreenCoordinates(new Point(0, 0));
            var a  = new MouseMovedEventArgs((long)args.Event.Time, args.Event.XRoot - sc.X, args.Event.YRoot - sc.Y);

            Toolkit.Invoke(delegate {
                EventSink.OnMouseMoved(a);
            });
            if (a.Handled)
            {
                args.RetVal = true;
            }
        }
 internal void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args)
 {
     if (!isClosed)
     {
         MonoDevelop.Core.Runtime.AssertMainThread();
         var but1 = (args.Event.State & Gdk.ModifierType.Button1Mask) == Gdk.ModifierType.Button1Mask;
         var but2 = (args.Event.State & Gdk.ModifierType.Button2Mask) == Gdk.ModifierType.Button2Mask;
         var but3 = (args.Event.State & Gdk.ModifierType.Button3Mask) == Gdk.ModifierType.Button3Mask;
         if (!but1 && !but2 && !but3)
         {
             this.HandleMouseMove(new Point(args.Event.X, args.Event.Y));
         }
     }
 }