Пример #1
0
        protected override bool OnScrollEvent(Gdk.EventScroll es)
        {
            bool result = base.OnScrollEvent(es);

            if (!this.isScrollWheelScaling)
            {
                this.isScrollWheelScaling = true;
                double mouseX = es.X;
                double mouseY = es.Y;
                DeviceToUser(ref mouseX, ref mouseY);
                this.mousePressedUserX = mouseX;
                this.mousePressedUserY = mouseY;
            }
            double scaleAdj = 1.0;

            if (es.Direction == ScrollDirection.Down)
            {
                scaleAdj -= this.scrollUnits;
            }
            else if (es.Direction == ScrollDirection.Up)
            {
                scaleAdj += this.scrollUnits;
            }
            ValidateScaleAdj(ref scaleAdj);
            if (scaleAdj != 1.0)
            {
                this.transformMatrix.Translate(mousePressedUserX, mousePressedUserY);
                this.transformMatrix.Scale(scaleAdj, scaleAdj);
                this.transformMatrix.Translate(-mousePressedUserX, -mousePressedUserY);
            }
            this.QueueDraw();
            return(result);
        }
Пример #2
0
    void ScrollHandler(object o, ScrollEventArgs args)
    {
        Gdk.EventScroll es     = args.Event;
        double          newloc = 0.0;

        switch (es.Direction)
        {
        case ScrollDirection.Up:
            newloc = adjustment.Value - visible_cols;
            break;

        case ScrollDirection.Down:
            newloc = adjustment.Value + visible_cols;
            break;
        }
        if (newloc < 0)
        {
            newloc = 0;
        }
        else if (newloc >= max_top)
        {
            newloc = Math.Max(max_top, 0);
        }

        adjustment.Value = newloc;
    }
Пример #3
0
 protected override bool OnScrollEvent(Gdk.EventScroll evnt)
 {
     if ((evnt.State & Gdk.ModifierType.ControlMask) != 0)
     {
         Zoom(evnt.Direction == ScrollDirection.Down ? -20 : 20);
         return(true);
     }
     else
     {
         return(base.OnScrollEvent(evnt));
     }
 }
Пример #4
0
 private void OnScrollEvent(object sender, ScrollEventArgs a)
 {
     Gdk.EventScroll ev = a.Event;
     if (ev.Direction == ScrollDirection.Up)
     {
         ZoomIn();
     }
     else
     {
         ZoomOut();
     }
     Redraw();
 }
Пример #5
0
        protected override bool OnScrollEvent(Gdk.EventScroll evnt)
        {
            switch (evnt.Direction)
            {
            case ScrollDirection.Up:
                TargetValue = Math.Max(TargetValue - Vadjustment.StepIncrement, 0);
                break;

            case ScrollDirection.Down:
                TargetValue = Math.Min(TargetValue + Vadjustment.StepIncrement, Vadjustment.Upper - Vadjustment.PageSize);
                break;

            default:
                return(base.OnScrollEvent(evnt));
            }
            return(true);
        }
Пример #6
0
        void ScrollHandler(object o, ScrollEventArgs args)
        {
            Gdk.EventScroll es     = args.Event;
            double          newloc = 0.0;
            int             steps  = Math.Max(rows / 6, 2);

            switch (es.Direction)
            {
            case ScrollDirection.Up:
                newloc = adjustment.Value - steps;
                break;

            case ScrollDirection.Down:
                newloc = adjustment.Value + steps;
                break;
            }

            newloc = Math.Max(newloc, 0);
            newloc = Math.Min(newloc, provider.Rows - rows);

            adjustment.Value = newloc;
        }
Пример #7
0
        /// <summary>
        /// Called when [scroll event].
        /// </summary>
        /// <param name="evnt">The evnt.</param>
        /// <returns></returns>
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            if (evnt.Direction == ScrollDirection.Up)
            {
                WaveServices.Input.MouseState.Wheel += 1;
            }
            else if (evnt.Direction == ScrollDirection.Down)
            {
                WaveServices.Input.MouseState.Wheel -= 1;
            }

            return base.OnScrollEvent(evnt);
        }
Пример #8
0
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            // Allow the user to zoom in/out with Ctrl-Mousewheel (as long as Shift and Alt are not also pressed)
            if ((evnt.State & (ModifierType.ControlMask | ModifierType.ShiftMask | ModifierType.Mod1Mask)) == ModifierType.ControlMask) {
                switch (evnt.Direction) {
                    case ScrollDirection.Down:
                    case ScrollDirection.Right:
                        PintaCore.Workspace.ActiveWorkspace.ZoomOutFromMouseScroll (new Cairo.PointD (evnt.X, evnt.Y));
                        return true;
                    case ScrollDirection.Left:
                    case ScrollDirection.Up:
                        PintaCore.Workspace.ActiveWorkspace.ZoomInFromMouseScroll (new Cairo.PointD (evnt.X, evnt.Y));
                        return true;
                }
            }

            return base.OnScrollEvent (evnt);
        }
Пример #9
0
 /// <summary>
 /// Called when the mouse wheel is scrolled.
 /// </summary>
 /// <param name="e">An instance that contains the event data.</param>
 /// <returns><c>true</c> if the event was handled.</returns>
 protected override bool OnScrollEvent(EventScroll e)
 {
     return this.ActualController.HandleMouseWheel(this, e.ToMouseWheelEventArgs());
 }
Пример #10
0
 protected override bool OnScrollEvent(Gdk.EventScroll evnt)
 {
     HideTooltipWindow();
     ClearMouseOverItem();
     return(base.OnScrollEvent(evnt));
 }
Пример #11
0
        public bool HandleScroll(EventScroll args)
        {
            if (editable) {
                switch (args.Direction) {
                case Gdk.ScrollDirection.Up:
                case Gdk.ScrollDirection.Right:
                    Value ++;
                    return true;

                case Gdk.ScrollDirection.Down:
                case Gdk.ScrollDirection.Left:
                    Value --;
                    return true;
                }

                return false;
            } else
                return true;
        }
Пример #12
0
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            if ((evnt.State & ModifierType.ShiftMask) == 0) {//no shift, let's zoom
                ZoomAboutPoint ((evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Right) ? ZOOM_FACTOR : 1.0 / ZOOM_FACTOR,
                         (int)evnt.X, (int)evnt.Y);
                return true;
            }

            int x_incr = (int)Hadjustment.PageIncrement / 4;
            int y_incr = (int)Vadjustment.PageIncrement / 4;
            if ((evnt.State & ModifierType.ControlMask) == 0) {//no control scroll
                ScrollBy ((evnt.Direction == ScrollDirection.Left) ? -x_incr : (evnt.Direction == ScrollDirection.Right) ? x_incr : 0,
                      (evnt.Direction == ScrollDirection.Up) ? -y_incr : (evnt.Direction == ScrollDirection.Down) ? y_incr : 0);
                return true;
            } else { //invert x and y for scrolling
                ScrollBy ((evnt.Direction == ScrollDirection.Up) ? -y_incr : (evnt.Direction == ScrollDirection.Down) ? y_incr : 0,
                      (evnt.Direction == ScrollDirection.Left) ? -x_incr : (evnt.Direction == ScrollDirection.Right) ? x_incr : 0);
                return true;
            }
        }
        protected override bool OnScrollEvent(EventScroll e)
        {
            if (e.Device.Source == InputSource.Mouse) {
                if (e.Direction == ScrollDirection.Up)
                    Scale = Scale + _range.Step;
                else if (e.Direction == ScrollDirection.Down)
                    Scale = Scale - _range.Step;
            }

            return base.OnScrollEvent (e);
        }
Пример #14
0
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            // Allow the user to zoom in/out with Ctrl-Mousewheel
            if (evnt.State  == ModifierType.ControlMask) {
                switch (evnt.Direction) {
                    case ScrollDirection.Down:
                    case ScrollDirection.Right:
                        PintaCore.Actions.View.ZoomOut.Activate ();
                        return true;
                    case ScrollDirection.Left:
                    case ScrollDirection.Up:
                        PintaCore.Actions.View.ZoomIn.Activate ();
                        return true;
                }
            }

            return base.OnScrollEvent (evnt);
        }
Пример #15
0
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            float shift = 1f;
            if ((evnt.State & ModifierType.ShiftMask) > 0)
                shift = 6f;

            switch (evnt.Direction) {
            case ScrollDirection.Up:
            case ScrollDirection.Right:
                Position = animation.To - shift;
                return true;
            case ScrollDirection.Down:
            case ScrollDirection.Left:
                Position = animation.To + shift;
                return true;
            }
            return false;
        }
Пример #16
0
 //MOUSE WHEEL
 protected override bool OnScrollEvent(EventScroll evnt)
 {
     //daca este inainte este pozitiva, daca este inapoi este negativa valoarea delta
     int delta = 120;
     if( evnt.Direction == ScrollDirection.Down ) delta = 0 - delta;
     GcMouseEventArgs args = new GcMouseEventArgs( this, 0, delta, (int)evnt.X, (int)evnt.Y, MouseButton.None );
     if( MouseWheel != null ) MouseWheel( this, args );
     return base.OnScrollEvent (evnt);
 }
Пример #17
0
		protected override bool OnScrollEvent (EventScroll evnt)
		{
			if (InternalDragActive || ConfigurationMode)
				return base.OnScrollEvent (evnt);
			
			if (Painter != null) {
				int x, y;
				
				x = LocalCursor.X - painter_area.X;
				y = LocalCursor.Y - painter_area.Y;
				
				if (painter_area.Contains (LocalCursor))
					Painter.Scrolled (evnt.Direction, x, y, evnt.State);
			} else if ((evnt.State & ModifierType.ControlMask) == ModifierType.ControlMask) {
				if (evnt.Direction == ScrollDirection.Up)
					Preferences.IconSize++;
				else if (evnt.Direction == ScrollDirection.Down)
					Preferences.IconSize--;
				return false;
			} else if (HoveredItem != null) {
				HoveredItem.Scrolled (evnt.Direction, evnt.State);
			}
			
			return base.OnScrollEvent (evnt);
		}
		protected override bool OnScrollEvent (EventScroll evnt)
		{
			if ((evnt.State & Gdk.ModifierType.ControlMask) == Gdk.ModifierType.ControlMask) {
				if (evnt.Direction == ScrollDirection.Down)
					Options.ZoomIn ();
				else 
					Options.ZoomOut ();
				this.Repaint ();
				return true;
			}
			return base.OnScrollEvent (evnt); 
		}
Пример #19
0
		protected override bool OnScrollEvent (EventScroll evnt)
		{
			var alloc = Allocation;
			double dx, dy;
			evnt.GetPageScrollPixelDeltas (alloc.Width, alloc.Height, out dx, out dy);
			
			if (dx != 0.0 && hScrollBar.Visible)
				hAdjustment.AddValueClamped (dx);
			
			if (dy != 0.0 && vScrollBar.Visible)
				vAdjustment.AddValueClamped (dy);
			
			return (dx != 0.0 || dy != 0.0) || base.OnScrollEvent (evnt);
		}
Пример #20
0
 protected override bool OnScrollEvent(Gdk.EventScroll evnt)
 {
     HideTipWindow();
     return(base.OnScrollEvent(evnt));
 }
Пример #21
0
 protected override bool OnScrollEvent(EventScroll evnt)
 {
     double step = 1;
     var delta = new Vector();
     if (evnt.Direction == ScrollDirection.Down)
         delta = new Vector(0, -step);
     else if (evnt.Direction == ScrollDirection.Up)
         delta = new Vector(0, step);
     else if (evnt.Direction == ScrollDirection.Right)
         delta = new Vector(-step, 0);
     if (evnt.Direction == ScrollDirection.Left)
         delta = new Vector(step, 0);
     var e = new RawMouseWheelEventArgs(GtkMouseDevice.Instance, evnt.Time, _inputRoot, new Point(evnt.X, evnt.Y), delta, GetModifierKeys(evnt.State));
     Input(e);
     return base.OnScrollEvent(evnt);
 }
Пример #22
0
		protected override bool OnScrollEvent (EventScroll args)
		{
			float shift = 1.0f;
			if ((args.State & Gdk.ModifierType.ShiftMask) > 0)
				shift = 6f;

			switch (args.Direction) {
			case ScrollDirection.Up:
			case ScrollDirection.Right:
				Position -= shift;
				return true;
			case Gdk.ScrollDirection.Down:
			case Gdk.ScrollDirection.Left:
				Position += shift;
				return true;
			}
			return false;
		}
Пример #23
0
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            // Allow the user to zoom in/out with Ctrl-Mousewheel
            if (FilterModifierKeys(evnt.State) == ModifierType.ControlMask) {
                switch (evnt.Direction) {
                    case ScrollDirection.Down:
                    case ScrollDirection.Right:
                        PintaCore.Workspace.ActiveWorkspace.ZoomOutFromMouseScroll (new Cairo.PointD (evnt.X, evnt.Y));
                        return true;
                    case ScrollDirection.Left:
                    case ScrollDirection.Up:
                        PintaCore.Workspace.ActiveWorkspace.ZoomInFromMouseScroll (new Cairo.PointD (evnt.X, evnt.Y));
                        return true;
                }
            }

            return base.OnScrollEvent (evnt);
        }
Пример #24
0
		// FIXME: if the editors have different adjustment ranges, the pixel deltas
		// don't really feel quite right since they're applied after scaling via the
		// linked adjustment
		protected override bool OnScrollEvent (EventScroll evnt)
		{
			//using the size of an editor for the calculations means pixel deltas apply better
			var alloc = editors[0].Allocation;
			
			double dx, dy;
			evnt.GetPageScrollPixelDeltas (alloc.Width, alloc.Height, out dx, out dy);
			
			if (dx != 0.0 && hAdjustment.PageSize < (hAdjustment.Upper - hAdjustment.Lower))
				hAdjustment.AddValueClamped (dx / (alloc.Width / hAdjustment.PageSize));
			
			if (dy != 0.0 && vAdjustment.PageSize < (vAdjustment.Upper - vAdjustment.Lower))
				vAdjustment.AddValueClamped (dy / (alloc.Height / vAdjustment.PageSize));
			
			return (dx != 0.0 || dy != 0.0) || base.OnScrollEvent (evnt);
		}
Пример #25
0
 protected override bool OnScrollEvent(EventScroll evnt)
 {
     _scrollStarted = DateTime.Now;
     return base.OnScrollEvent(evnt);
 }
Пример #26
0
 protected override bool OnScrollEvent(EventScroll evnt)
 {
     Hide();
     return _trackListView.ProcessEvent(evnt);
 }
Пример #27
0
		protected override bool OnScrollEvent (EventScroll evnt)
		{
			Scrollbar scrollWidget = (evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Down) ? (Scrollbar)vScrollBar : hScrollBar;
			if (scrollWidget.Visible) {
				double newValue = scrollWidget.Adjustment.Value + GetWheelDelta (scrollWidget, evnt.Direction);
				newValue = System.Math.Max (System.Math.Min (scrollWidget.Adjustment.Upper  - scrollWidget.Adjustment.PageSize, newValue), scrollWidget.Adjustment.Lower);
				scrollWidget.Adjustment.Value = newValue;
			}
			return base.OnScrollEvent (evnt);
		}
Пример #28
0
		protected override bool OnScrollEvent (EventScroll evnt)
		{
			var adjustment = (evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Down) ? vAdjustment : hAdjustment;

			if (adjustment.PageSize < adjustment.Upper) {
				double newValue = adjustment.Value + GetWheelDelta (adjustment, evnt.Direction);
				newValue = System.Math.Max (System.Math.Min (adjustment.Upper  - adjustment.PageSize, newValue), adjustment.Lower);
				adjustment.Value = newValue;
			}
			return base.OnScrollEvent (evnt);
		}
Пример #29
0
 protected override bool OnScrollEvent(EventScroll args)
 {
     return HandleScroll (args);
 }
Пример #30
0
		protected override bool OnScrollEvent (EventScroll evnt)
		{
			var scrollWidget = (evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Down) ? vScrollBar : hScrollBar;
			var adj = (evnt.Direction == ScrollDirection.Up || evnt.Direction == ScrollDirection.Down) ? vAdjustment : hAdjustment;
			
			if (scrollWidget.Visible) {
				double newValue = adj.Value + GetWheelDelta (adj, evnt.Direction, scrollWidget is Scrollbar ?  ((Scrollbar)scrollWidget).Inverted : false);
				newValue = System.Math.Max (System.Math.Min (adj.Upper - adj.PageSize, newValue), adj.Lower);
				adj.Value = newValue;
			}
			return base.OnScrollEvent (evnt);
		}