Exemplo n.º 1
0
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void MouseWheel(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (sender == null)
				return;
			sender.Cursor = Cursors.Cross;
			Rectangle r_Gitter = sender.GridRectangle;
			double dx = (double)(e.X - r_Gitter.X) / (double)(r_Gitter.Width),
				dy = (double)(e.Y - r_Gitter.Y) / (double)(r_Gitter.Height);
			if (e.Delta > 0)
			{
				if (r_Gitter.Width < 400 && r_Gitter.Height < 400)
				{
					r_Gitter.Width *= 2;
					r_Gitter.Height *= 2;
				}
			}
			else if (e.Delta < 0)
			{
				if (r_Gitter.Width > 5 && r_Gitter.Height > 5)
				{
					r_Gitter.Width /= 2;
					r_Gitter.Height /= 2;
				}
			}
			if (!sender.CenterAxis)
			{
				r_Gitter.X = (int)(e.X - dx * (double)(r_Gitter.Width));
				r_Gitter.Y = (int)(e.Y - dy * (double)(r_Gitter.Height));
			}
			sender.GridRectangle = r_Gitter;
		}
Exemplo n.º 2
0
		/// <summary>
		/// </summary>
		protected void AutomaticMove(NuGenVisiPlot2D sender, MouseEventArgs e, bool invert)
		{
			if (sender == null)
				return;
			int dx = 0, dy = 0;
			if (e.X - sender.InnerMargin.X < 0)
				dx = Math.Max(-20, e.X - sender.InnerMargin.X);
			else if (e.X - sender.InnerMargin.Right > 0)
				dx = Math.Min(20, e.X - sender.InnerMargin.Right);

			if (e.Y - sender.InnerMargin.Y < 0)
				dy = Math.Max(-20, e.Y - sender.InnerMargin.Y);
			else if (e.Y - sender.InnerMargin.Bottom > 0)
				dy = Math.Min(20, e.Y - sender.InnerMargin.Bottom);

			if (invert)
			{
				dx = -dx;
				dy = -dy;
			}
			if (Control.ModifierKeys == Keys.Control)
			{
				dx = (int)(5.1 * (double)dx);
				dy = (int)(5.1 * (double)dy);
			}
			if (dx != 0 || dy != 0)
			{
				Rectangle r_Gitter = sender.GridRectangle;
				r_Gitter.X += dx;
				r_Gitter.Y += dy;
				sender.GridRectangle = r_Gitter;
			}
		}
Exemplo n.º 3
0
        /// <summary>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void MouseDown(NuGenVisiPlot2D sender, MouseEventArgs e)
        {
            if (sender == null || e.Button != MouseButtons.Left)
            {
                return;
            }
            NuGenPlotPaintInterval selscr = sender.SelectionScreen;

            ac = Action(selscr, e.X);
            switch (ac)
            {
            case 1:
            case 3:
                dx = e.X - selscr.Start;
                break;

            case 2:
                dx = e.X - selscr.End;
                break;

            default:
                sender.SelectionScreen = new NuGenPlotPaintInterval(e.X, 0);
                dx = 0;
                ac = 2;
                break;
            }
            sender.Cursor = _curs[ac];
        }
Exemplo n.º 4
0
        /// <summary>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void MouseWheel(NuGenVisiPlot2D sender, MouseEventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            sender.Cursor = Cursors.Cross;
            Rectangle r_Gitter = sender.GridRectangle;
            double    dx       = (double)(e.X - r_Gitter.X) / (double)(r_Gitter.Width),
                      dy       = (double)(e.Y - r_Gitter.Y) / (double)(r_Gitter.Height);

            if (e.Delta > 0)
            {
                if (r_Gitter.Width < 400 && r_Gitter.Height < 400)
                {
                    r_Gitter.Width  *= 2;
                    r_Gitter.Height *= 2;
                }
            }
            else if (e.Delta < 0)
            {
                if (r_Gitter.Width > 5 && r_Gitter.Height > 5)
                {
                    r_Gitter.Width  /= 2;
                    r_Gitter.Height /= 2;
                }
            }
            if (!sender.CenterAxis)
            {
                r_Gitter.X = (int)(e.X - dx * (double)(r_Gitter.Width));
                r_Gitter.Y = (int)(e.Y - dy * (double)(r_Gitter.Height));
            }
            sender.GridRectangle = r_Gitter;
        }
Exemplo n.º 5
0
 /// <summary>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void MouseMove(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     if (sender == null)
     {
         return;
     }
     DoSelection(sender, e);
 }
Exemplo n.º 6
0
 /// <summary>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void MouseUp(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     if (sender == null)
     {
         return;
     }
     sender.Selection = NuGenVisiPlot2D.RightOrderInterval(sender.Selection);
 }
Exemplo n.º 7
0
 /// <summary>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void MouseUp(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     if (sender == null)
     {
         return;
     }
     sender.Cursor = Cursors.Default;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NuGenFormulaCollection"/> class.
        /// </summary>
        /// <exception cref="ArgumentNullException"><para><paramref name="owner"/> is <see langword="null"/>.</para></exception>
        public NuGenFormulaCollection(NuGenVisiPlot2D owner)
        {
            if (owner == null)
            {
                throw new ArgumentNullException();
            }

            _owner = owner;
        }
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void TimerScroll(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (sender == null)
				return;
			sender.BeginUpdate();
			base.AutomaticMove(sender, e, true);
			DoSelection(sender, e);
			sender.EndUpdate();
		}
Exemplo n.º 10
0
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void MouseDown(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (sender == null)
				return;
			if (e.Button == MouseButtons.Left)
			{
				sender.Cursor = Cursors.Hand;
				i_Mx = e.X;
				i_My = e.Y;
			}
		}
Exemplo n.º 11
0
 /// <summary>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void TimerScroll(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     if (sender == null)
     {
         return;
     }
     sender.BeginUpdate();
     base.AutomaticMove(sender, e, true);
     DoSelection(sender, e);
     sender.EndUpdate();
 }
Exemplo n.º 12
0
 /// <summary>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void MouseDown(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     if (sender == null)
     {
         return;
     }
     if (e.Button == MouseButtons.Left)
     {
         sender.Cursor = Cursors.Hand;
         i_Mx          = e.X;
         i_My          = e.Y;
     }
 }
Exemplo n.º 13
0
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void MouseMove(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (sender == null)
				return;
			if (e.Button == MouseButtons.Left)
			{
				Rectangle r_Gitter = sender.GridRectangle;
				r_Gitter.Offset(e.X - i_Mx, e.Y - i_My);
				i_Mx = e.X;
				i_My = e.Y;
				sender.GridRectangle = r_Gitter;
			}
		}
Exemplo n.º 14
0
 /// <summary>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void MouseMove(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     if (sender == null)
     {
         return;
     }
     if (e.Button == MouseButtons.Left)
     {
         Rectangle r_Gitter = sender.GridRectangle;
         r_Gitter.Offset(e.X - i_Mx, e.Y - i_My);
         i_Mx = e.X;
         i_My = e.Y;
         sender.GridRectangle = r_Gitter;
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// </summary>
        protected void AutomaticMove(NuGenVisiPlot2D sender, MouseEventArgs e, bool invert)
        {
            if (sender == null)
            {
                return;
            }
            int dx = 0, dy = 0;

            if (e.X - sender.InnerMargin.X < 0)
            {
                dx = Math.Max(-20, e.X - sender.InnerMargin.X);
            }
            else if (e.X - sender.InnerMargin.Right > 0)
            {
                dx = Math.Min(20, e.X - sender.InnerMargin.Right);
            }

            if (e.Y - sender.InnerMargin.Y < 0)
            {
                dy = Math.Max(-20, e.Y - sender.InnerMargin.Y);
            }
            else if (e.Y - sender.InnerMargin.Bottom > 0)
            {
                dy = Math.Min(20, e.Y - sender.InnerMargin.Bottom);
            }

            if (invert)
            {
                dx = -dx;
                dy = -dy;
            }
            if (Control.ModifierKeys == Keys.Control)
            {
                dx = (int)(5.1 * (double)dx);
                dy = (int)(5.1 * (double)dy);
            }
            if (dx != 0 || dy != 0)
            {
                Rectangle r_Gitter = sender.GridRectangle;
                r_Gitter.X          += dx;
                r_Gitter.Y          += dy;
                sender.GridRectangle = r_Gitter;
            }
        }
Exemplo n.º 16
0
        private void DoSelection(NuGenVisiPlot2D sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                ac = Action(
                    sender.SelectionScreen, e.X);
                sender.Cursor = _curs[ac];
            }
            else
            {
                Rectangle r_Gitter         = sender.GridRectangle;
                NuGenPlotPaintInterval sel = sender.SelectionScreen;
                switch (ac)
                {
                case 3:
                    int w = sel.Width;
                    sel.Start = e.X - dx;
                    sel.Width = w;
                    break;

                case 1:
                    sel = new NuGenPlotPaintInterval(e.X - dx, sel.End);
                    break;

                case 2:
                    sel = new NuGenPlotPaintInterval(sel.Start, e.X - dx);
                    break;

                case 0:
                    sel.Start = sel.End = e.X - dx;
                    break;
                }
                if (Control.ModifierKeys == Keys.Shift)
                {
                    sender.SetSelectionScreenRound(sel);
                }
                else
                {
                    sender.SelectionScreen = sel;
                }
            }
        }
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void MouseDown(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (sender == null || e.Button != MouseButtons.Left)
				return;
			NuGenPlotPaintInterval selscr = sender.SelectionScreen;
			ac = Action(selscr, e.X);
			switch (ac)
			{
				case 1:
				case 3:
				dx = e.X - selscr.Start;
				break;
				case 2:
				dx = e.X - selscr.End;
				break;
				default:
				sender.SelectionScreen = new NuGenPlotPaintInterval(e.X, 0);
				dx = 0;
				ac = 2;
				break;
			}
			sender.Cursor = _curs[ac];
		}
Exemplo n.º 18
0
 /// <summary>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void TimerScroll(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     base.AutomaticMove(sender, e, false);
 }
		private void DoSelection(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (e.Button != MouseButtons.Left)
			{
				ac = Action(
					sender.SelectionScreen, e.X);
				sender.Cursor = _curs[ac];
			}
			else
			{
				Rectangle r_Gitter = sender.GridRectangle;
				NuGenPlotPaintInterval sel = sender.SelectionScreen;
				switch (ac)
				{
					case 3:
					int w = sel.Width;
					sel.Start = e.X - dx;
					sel.Width = w;
					break;
					case 1:
					sel = new NuGenPlotPaintInterval(e.X - dx, sel.End);
					break;
					case 2:
					sel = new NuGenPlotPaintInterval(sel.Start, e.X - dx);
					break;
					case 0:
					sel.Start = sel.End = e.X - dx;
					break;
				}
				if (Control.ModifierKeys == Keys.Shift)
					sender.SetSelectionScreenRound(sel);
				else
					sender.SelectionScreen = sel;
			}
		}
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void MouseUp(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (sender == null)
				return;
			sender.Selection = NuGenVisiPlot2D.RightOrderInterval(sender.Selection);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenFormulaCollection"/> class.
		/// </summary>
		/// <exception cref="ArgumentNullException"><para><paramref name="owner"/> is <see langword="null"/>.</para></exception>
		public NuGenFormulaCollection(NuGenVisiPlot2D owner)
		{
			if (owner == null)
				throw new ArgumentNullException();

			_owner = owner;
		}
Exemplo n.º 22
0
 /// <summary>
 /// </summary>
 public virtual void TimerScroll(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     return;
 }
Exemplo n.º 23
0
 /// <summary>
 /// </summary>
 public virtual void MouseUp(NuGenVisiPlot2D sender, MouseEventArgs e)
 {
     return;
 }
Exemplo n.º 24
0
		/// <summary>
		/// </summary>
		public virtual void TimerScroll(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			return;
		}
Exemplo n.º 25
0
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void MouseUp(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (sender == null)
				return;
			sender.Cursor = Cursors.Default;
		}
Exemplo n.º 26
0
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void TimerScroll(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			base.AutomaticMove(sender, e, false);
		}
Exemplo n.º 27
0
		/// <summary>
		/// </summary>
		public virtual void MouseUp(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			return;
		}
		/// <summary>
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		public override void MouseMove(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (sender == null)
				return;
			DoSelection(sender, e);
		}