Exemplo n.º 1
0
		protected internal override void OnMouseMoved(BasicMouseEventArgs e){
			int x = Vertical ? e.Y : e.X;
			for (int i = 0; i < Positions.Count; i++){
				int p = ModelToView(Positions[i], e.Width, e.Height);
				if (p == x){
					int d = mouseOverIndex - i;
					mouseOverIndex = i;
					if (d != 0){
						Invalidate();
					}
					return;
				}
			}
			for (int i = 0; i < Positions.Count; i++){
				int p = ModelToView(Positions[i], e.Width, e.Height);
				if (Math.Abs(p - x) < 2){
					int d = mouseOverIndex - i;
					mouseOverIndex = i;
					if (d != 0){
						Invalidate();
					}
					return;
				}
			}
			int f = mouseOverIndex + 1;
			mouseOverIndex = -1;
			if (f != 0){
				Invalidate();
			}
		}
        public override void OnMouseMoved(BasicMouseEventArgs e)
        {
            ScrollBarState newState = ScrollBarState.Neutral;

            if (e.Y < GraphUtil.scrollBarWidth - 1)
            {
                newState = ScrollBarState.HighlightFirstBox;
            }
            else if (e.Y > e.Height - GraphUtil.scrollBarWidth)
            {
                newState = ScrollBarState.HighlightSecondBox;
            }
            else if (HasBar)
            {
                int s = CalcBarStart(e.Height);
                int l = CalcBarSize(e.Height);
                if (e.Y >= s && e.Y <= s + l)
                {
                    newState = ScrollBarState.HighlightBar;
                }
            }
            if (newState != state)
            {
                state = newState;
                Invalidate();
            }
        }
Exemplo n.º 3
0
		protected internal override void OnMouseIsUp(BasicMouseEventArgs e){
			if (!hasMoved){
				if (e.IsMainButton){
					ColorDialog cd = new ColorDialog();
					if (cd.ShowDialog() == DialogResult.OK){
						if (mouseOverIndex != -1){
							Colors[mouseOverIndex] = cd.Color;
						} else{
							Colors.Add(cd.Color);
							Positions.Add(ViewToModel(Vertical ? e.Y : e.X, e.Width, e.Height));
						}
						refreshColors = true;
						fireChange = true;
						Invalidate();
					}
				} else{
					if (mouseOverIndex != -1 && Colors.Count > 2){
						Colors.RemoveAt(mouseOverIndex);
						Positions.RemoveAt(mouseOverIndex);
						refreshColors = true;
						fireChange = true;
						Invalidate();
					}
				}
			} else{
				FireColorChanged();
			}
			mouseDragIndex = -1;
		}
Exemplo n.º 4
0
        public override void OnMouseMoved(BasicMouseEventArgs e)
        {
            if (xpos == null || ypos == null)
            {
                return;
            }
            int indX = GetSeparatorInd(xpos, e.X);
            int indY = GetSeparatorInd(ypos, e.Y);

            if (indX >= 0)
            {
                indY = -1;
            }
            if (indX >= 0 || indY >= 0)
            {
                Cursor            = indX >= 0 ? Cursors2.VSplit : Cursors2.HSplit;
                currentComponentX = -1;
                currentComponentY = -1;
            }
            else
            {
                ResetCursor();
                currentComponentX = GetCurrentComponentInd(xpos, e.X);
                currentComponentY = GetCurrentComponentInd(ypos, e.Y);
                Tuple <int, int> key = new Tuple <int, int>(currentComponentY, currentComponentX);
                if (components.ContainsKey(key))
                {
                    BasicView v = components[key];
                    try{
                        v.OnMouseMoved(new BasicMouseEventArgs(e, xpos[currentComponentX], ypos[currentComponentY],
                                                               widths[currentComponentX], heights[currentComponentY]));
                    } catch (Exception) {}
                }
            }
        }
 public override void OnMouseIsUp(BasicMouseEventArgs e)
 {
     main.OnMouseIsUpMainView?.Invoke(e.Scale(main.ZoomFactor));
     navigatorData.Reset();
     state = ZoomButtonState.Neutral;
     Invalidate();
 }
Exemplo n.º 6
0
 public override void OnMouseDoubleClick(BasicMouseEventArgs e)
 {
     if (!Visible)
     {
         return;
     }
     if (!IsValid())
     {
         return;
     }
     if (e.IsMainButton)
     {
         if (ZoomType == AxisZoomType.None)
         {
             return;
         }
         switch (MouseMode)
         {
         case AxisMouseMode.Zoom:
             FullZoom();
             break;
         }
     }
     else
     {
         ZeroPoint = double.NaN;
     }
 }
Exemplo n.º 7
0
        public override void OnMouseIsDown(BasicMouseEventArgs e)
        {
            int indX1 = GetSeparatorInd(xpos, e.X);
            int indY1 = GetSeparatorInd(ypos, e.Y);

            if (indX1 >= 0)
            {
                indY1 = -1;
            }
            if (indX1 >= 0 || indY1 >= 0)
            {
                dragging  = true;
                dragX     = indX1 >= 0;
                dragIndex = indX1 >= 0 ? indX1 : indY1;
                return;
            }
            int       indX;
            int       indY;
            BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY);

            if (v != null)
            {
                v.OnMouseIsDown(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY]));
                mouseDownX = indX;
                mouseDownY = indY;
            }
        }
Exemplo n.º 8
0
        protected internal override void OnMouseMoved(BasicMouseEventArgs e)
        {
            ScrollBarState newState = ScrollBarState.Neutral;

            if (e.X < CompoundScrollableControl.scrollBarWidth - 1)
            {
                newState = ScrollBarState.HighlightFirstBox;
            }
            else if (e.X > e.Width - CompoundScrollableControl.scrollBarWidth)
            {
                newState = ScrollBarState.HighlightSecondBox;
            }
            else if (HasBar)
            {
                int s = CalcBarStart(e.Width);
                int l = CalcBarSize(e.Width);
                if (e.X >= s && e.X <= s + l)
                {
                    newState = ScrollBarState.HighlightBar;
                }
            }
            if (newState != state)
            {
                state = newState;
                Invalidate();
            }
        }
 protected internal override void OnMouseIsDown(BasicMouseEventArgs e)
 {
     indicatorX1 = e.X;
     indicatorX2 = indicatorX1;
     indicatorY1 = e.Y;
     indicatorY2 = indicatorY1;
 }
Exemplo n.º 10
0
 protected internal override void OnMouseDoubleClick(BasicMouseEventArgs e)
 {
     if (!Visible)
     {
         return;
     }
     if (!IsValid())
     {
         return;
     }
     if (e.IsMainButton)
     {
         if (ZoomType == AxisZoomType.None)
         {
             return;
         }
         switch (MouseMode)
         {
         case AxisMouseMode.Zoom:
             ZoomMin = TotalMin;
             ZoomMax = TotalMax;
             FireZoomChanged();
             Invalidate();
             break;
         }
     }
     else
     {
         ZeroPoint = Double.NaN;
     }
 }
Exemplo n.º 11
0
        public override void OnMouseWheel(BasicMouseEventArgs e)
        {
            int       indX;
            int       indY;
            BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY);

            v?.OnMouseWheel(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY]));
        }
Exemplo n.º 12
0
 protected internal override void OnMouseDoubleClick(BasicMouseEventArgs e)
 {
     indicatorX1 = -1;
     indicatorX2 = -1;
     indicatorY1 = -1;
     indicatorY2 = -1;
     FireZoom(false, e.Width, e.Height);
     Invalidate();
 }
Exemplo n.º 13
0
 protected internal override void OnMouseDragged(BasicMouseEventArgs e)
 {
     indicatorX2 = e.X;
     indicatorX2 = Math.Max(0, indicatorX2);
     indicatorX2 = Math.Min(e.Width - 1, indicatorX2);
     indicatorY2 = e.Y;
     indicatorY2 = Math.Max(0, indicatorY2);
     indicatorY2 = Math.Min(e.Height - 1, indicatorY2);
     Invalidate();
 }
        public override void OnMouseMoved(BasicMouseEventArgs e)
        {
            main.OnMouseMoveMainView?.Invoke(e.Scale(main.ZoomFactor));
            ZoomButtonState newState = GraphUtil.GetNewZoomButtonState(e.X, e.Y, e.Width, e.Height, false);

            if (newState != state)
            {
                state = newState;
                Invalidate();
            }
        }
Exemplo n.º 15
0
        public override void OnMouseIsUp(BasicMouseEventArgs e)
        {
            if (dragging)
            {
                dragging = false;
                return;
            }
            BasicView v = GetComponentAt(mouseDownX, mouseDownY);

            v?.OnMouseIsUp(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX], heights[mouseDownY]));
        }
Exemplo n.º 16
0
        public override void OnMouseDragged(BasicMouseEventArgs e)
        {
            if (dragging)
            {
            }
            BasicView v = GetComponentAt(mouseDownX, mouseDownY);

            v?.OnMouseDragged(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX],
                                                      heights[mouseDownY]));
            //TODO: splitter
        }
 public override void OnMouseDragged(BasicMouseEventArgs e)
 {
     if (navigatorData.IsMoving())
     {
         PointI2 newXy = navigatorData.Dragging(e.X, e.Y, e.Width, e.Height, main.TotalWidth(), main.TotalHeight(),
                                                main.VisibleWidth, main.VisibleHeight, main.ZoomFactor);
         main.VisibleX = newXy.X;
         main.VisibleY = newXy.Y;
         invalidate();
         return;
     }
     main.OnMouseDraggedMainView?.Invoke(e.Scale(main.ZoomFactor));
 }
Exemplo n.º 18
0
        // ReSharper restore FunctionNeverReturns

        protected internal override void OnMouseDragged(BasicMouseEventArgs e)
        {
            if (state != ScrollBarState.PressBar)
            {
                return;
            }
            int hx = e.Height - 2 * CompoundScrollableControl.scrollBarWidth + 2;
            int y  = visibleDragStart + (int)Math.Round((e.Y - dragStart) / (double)hx * main.TotalHeight);

            y             = Math.Max(0, y);
            y             = Math.Min(main.TotalHeight - main.VisibleHeight, y);
            main.VisibleY = y;
            Invalidate();
        }
Exemplo n.º 19
0
        // ReSharper restore FunctionNeverReturns
        protected internal override void OnMouseDragged(BasicMouseEventArgs e)
        {
            if (state != ScrollBarState.PressBar)
            {
                return;
            }
            int hx = e.Width - 2 * CompoundScrollableControl.scrollBarWidth + 2;
            int x  = visibleDragStart + (int)Math.Round((e.X - dragStart) / (double)hx * main.TotalWidth);

            x             = Math.Max(0, x);
            x             = Math.Min(main.TotalWidth - main.VisibleWidth, x);
            main.VisibleX = x;
            Invalidate();
        }
Exemplo n.º 20
0
        internal void Center(BasicMouseEventArgs e)
        {
            if (IsFullZoom())
            {
                return;
            }
            double delta  = (ZoomMax - ZoomMin) * 0.5;
            double center = ViewToModel(IsHorizontal() ? e.X : e.Y, e.Width, e.Height);

            ZoomMin = center - delta;
            ZoomMax = center + delta;
            MoveZoomIntoRange();
            Invalidate();
        }
Exemplo n.º 21
0
        // ReSharper restore FunctionNeverReturns
        public override void OnMouseDragged(BasicMouseEventArgs e)
        {
            if (state != ScrollBarState.PressBar)
            {
                return;
            }
            int hx = e.Height - 2 * GraphUtil.scrollBarWidth + 2;
            int y  = visibleDragStart + (int)Math.Round((e.Y - dragStart) / (double)hx * main.TotalHeight());

            y             = Math.Max(0, y);
            y             = (int)Math.Min(main.TotalHeight() - main.VisibleHeight / main.ZoomFactor, y);
            main.VisibleY = y;
            Invalidate();
        }
Exemplo n.º 22
0
        // ReSharper restore FunctionNeverReturns
        public override void OnMouseDragged(BasicMouseEventArgs e)
        {
            if (state != ScrollBarState.PressBar)
            {
                return;
            }
            int hx = e.Width - 2 * GraphUtil.scrollBarWidth + 2;
            int x  = visibleDragStart + (int)Math.Round((e.X - dragStart) / (double)hx * main.TotalWidth());

            x             = Math.Max(0, x);
            x             = (int)Math.Min(main.TotalWidth() - main.VisibleWidth / main.ZoomFactor, x);
            main.VisibleX = x;
            Invalidate();
        }
Exemplo n.º 23
0
 protected internal override void OnMouseClick(BasicMouseEventArgs e)
 {
     switch (MouseMode)
     {
     case ScatterPlotMouseMode.Zoom:
     case ScatterPlotMouseMode.Select:
         if (!HasMoved())
         {
             bool add = e.ControlPressed;
             SelectAt(e.X, e.Y, add, e.Width, e.Height);
             Invalidate();
         }
         break;
     }
 }
Exemplo n.º 24
0
		protected internal override void OnMouseDragged(BasicMouseEventArgs e){
			if (e.IsMainButton){
				int w = Vertical ? e.Y : e.X;
				if (w != mouseStartPos){
					hasMoved = true;
				}
				if (mouseDragIndex != -1){
					w = Math.Max(0, w);
					w = Math.Min(w, GetLength(e.Width, e.Height) - 1);
					Positions[mouseDragIndex] = ViewToModel(w, e.Width, e.Height);
					refreshColors = true;
					Invalidate();
				}
			}
		}
Exemplo n.º 25
0
        public override void OnMouseIsDown(BasicMouseEventArgs e)
        {
            ScrollBarState newState = ScrollBarState.Neutral;

            if (e.X < GraphUtil.scrollBarWidth - 1)
            {
                newState = ScrollBarState.PressFirstBox;
                MoveLeft(main.DeltaX());
                leftThread = new Thread(() => WalkLeft(main.DeltaX()));
                leftThread.Start();
            }
            else if (e.X > e.Width - GraphUtil.scrollBarWidth)
            {
                newState = ScrollBarState.PressSecondBox;
                MoveRight(main.DeltaX());
                rightThread = new Thread(() => WalkRight(main.DeltaX()));
                rightThread.Start();
            }
            else if (HasBar)
            {
                int s = CalcBarStart(e.Width);
                int l = CalcBarSize(e.Width);
                if (e.X >= s && e.X <= s + l)
                {
                    newState         = ScrollBarState.PressBar;
                    dragStart        = e.X;
                    visibleDragStart = main.VisibleX;
                }
                else if (e.X < s)
                {
                    MoveLeft((int)(main.VisibleWidth / main.ZoomFactor));
                    leftThread = new Thread(() => WalkLeft((int)(main.VisibleWidth / main.ZoomFactor)));
                    leftThread.Start();
                }
                else
                {
                    MoveRight((int)(main.VisibleWidth / main.ZoomFactor));
                    rightThread = new Thread(() => WalkRight((int)(main.VisibleWidth / main.ZoomFactor)));
                    rightThread.Start();
                }
            }
            if (newState != state)
            {
                state = newState;
                Invalidate();
            }
        }
Exemplo n.º 26
0
        protected internal override void OnMouseIsDown(BasicMouseEventArgs e)
        {
            ScrollBarState newState = ScrollBarState.Neutral;

            if (e.X < CompoundScrollableControl.scrollBarWidth - 1)
            {
                newState = ScrollBarState.PressFirstBox;
                MoveLeft(main.DeltaX);
                leftThread = new Thread(() => WalkLeft(main.DeltaX));
                leftThread.Start();
            }
            else if (e.X > e.Width - CompoundScrollableControl.scrollBarWidth)
            {
                newState = ScrollBarState.PressSecondBox;
                MoveRight(main.DeltaX);
                rightThread = new Thread(() => WalkRight(main.DeltaX));
                rightThread.Start();
            }
            else if (HasBar)
            {
                int s = CalcBarStart(e.Width);
                int l = CalcBarSize(e.Width);
                if (e.X >= s && e.X <= s + l)
                {
                    newState         = ScrollBarState.PressBar;
                    dragStart        = e.X;
                    visibleDragStart = main.VisibleX;
                }
                else if (e.X < s)
                {
                    MoveLeft(main.VisibleWidth);
                    leftThread = new Thread(() => WalkLeft(main.VisibleWidth));
                    leftThread.Start();
                }
                else
                {
                    MoveRight(main.VisibleWidth);
                    rightThread = new Thread(() => WalkRight(main.VisibleWidth));
                    rightThread.Start();
                }
            }
            if (newState != state)
            {
                state = newState;
                Invalidate();
            }
        }
Exemplo n.º 27
0
        public override void OnMouseIsDown(BasicMouseEventArgs e)
        {
            if (!Visible)
            {
                return;
            }
            if (!IsValid())
            {
                return;
            }
            if (e.IsMainButton)
            {
                if (ZoomType == AxisZoomType.None)
                {
                    return;
                }
                switch (MouseMode)
                {
                case AxisMouseMode.Zoom:
                    indicator1 = IsHorizontal() ? e.X : e.Y;
                    indicator2 = indicator1;
                    break;

                case AxisMouseMode.Move:
                    switch (ZoomType)
                    {
                    case AxisZoomType.Indicate:
                        Center(e);
                        break;

                    case AxisZoomType.Zoom:
                        if (IsFullZoom())
                        {
                            return;
                        }
                        dragStart = ViewToModel(IsHorizontal() ? e.X : e.Y, e.Width, e.Height);
                        break;
                    }
                    break;
                }
            }
            else
            {
                ZeroPoint = ViewToModel(IsHorizontal() ? e.X : e.Y, e.Width, e.Height);
            }
        }
Exemplo n.º 28
0
        protected internal override void OnMouseIsUp(BasicMouseEventArgs e)
        {
            if (leftThread != null)
            {
                leftThread.Abort();
                leftThread = null;
            }
            if (rightThread != null)
            {
                rightThread.Abort();
                rightThread = null;
            }
            const ScrollBarState newState = ScrollBarState.Neutral;

            OnMouseMoved(e);
            state = newState;
            Invalidate();
        }
Exemplo n.º 29
0
        public override void OnMouseIsUp(BasicMouseEventArgs e)
        {
            if (upThread != null)
            {
                upThread.Abort();
                upThread = null;
            }
            if (downThread != null)
            {
                downThread.Abort();
                downThread = null;
            }
            const ScrollBarState newState = ScrollBarState.Neutral;

            OnMouseMoved(e);
            state = newState;
            Invalidate();
        }
        public override void OnMouseDoubleClick(BasicMouseEventArgs e)
        {
            Size2 overview = GraphUtil.CalcOverviewSize(e.Width, e.Height, main.TotalWidth(), main.TotalHeight());

            if (e.X < overview.Width && e.Y > e.Height - overview.Height)
            {
                return;
            }
            if (GraphUtil.HitsMinusButton(e.X, e.Y, e.Width, e.Height))
            {
                return;
            }
            if (GraphUtil.HitsPlusButton(e.X, e.Y, e.Width, e.Height))
            {
                return;
            }
            main.OnMouseDoubleClickMainView?.Invoke(e.Scale(main.ZoomFactor));
        }
Exemplo n.º 31
0
 public virtual void OnMouseIsUp(BasicMouseEventArgs e)
 {
 }
Exemplo n.º 32
0
 public virtual void OnMouseMoved(BasicMouseEventArgs e)
 {
 }
Exemplo n.º 33
0
 public virtual void OnMouseWheel(BasicMouseEventArgs e)
 {
 }
Exemplo n.º 34
0
 public virtual void OnMouseDoubleClick(BasicMouseEventArgs e)
 {
 }
Exemplo n.º 35
0
 public virtual void OnMouseDragged(BasicMouseEventArgs e)
 {
 }
Exemplo n.º 36
0
 public override void OnMouseDragged(BasicMouseEventArgs e)
 {
     if (dragging){}
     BasicView v = GetComponentAt(mouseDownX, mouseDownY);
     v?.OnMouseDragged(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX],
         heights[mouseDownY]));
     //TODO: splitter
 }
Exemplo n.º 37
0
 public override void OnMouseIsDown(BasicMouseEventArgs e)
 {
     int indX1 = GetSeparatorInd(xpos, e.X);
     int indY1 = GetSeparatorInd(ypos, e.Y);
     if (indX1 >= 0){
         indY1 = -1;
     }
     if (indX1 >= 0 || indY1 >= 0){
         dragging = true;
         dragX = indX1 >= 0;
         dragIndex = indX1 >= 0 ? indX1 : indY1;
         return;
     }
     int indX;
     int indY;
     BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY);
     if (v != null){
         v.OnMouseIsDown(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY]));
         mouseDownX = indX;
         mouseDownY = indY;
     }
 }
Exemplo n.º 38
0
 public override void OnMouseIsUp(BasicMouseEventArgs e)
 {
     if (dragging){
         dragging = false;
         return;
     }
     BasicView v = GetComponentAt(mouseDownX, mouseDownY);
     v?.OnMouseIsUp(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX], heights[mouseDownY]));
 }
Exemplo n.º 39
0
 public override void OnMouseMoved(BasicMouseEventArgs e)
 {
     if (xpos == null || ypos == null){
         return;
     }
     int indX = GetSeparatorInd(xpos, e.X);
     int indY = GetSeparatorInd(ypos, e.Y);
     if (indX >= 0){
         indY = -1;
     }
     if (indX >= 0 || indY >= 0){
         Cursor = indX >= 0 ? Cursors2.VSplit : Cursors2.HSplit;
         currentComponentX = -1;
         currentComponentY = -1;
     } else{
         ResetCursor();
         currentComponentX = GetCurrentComponentInd(xpos, e.X);
         currentComponentY = GetCurrentComponentInd(ypos, e.Y);
         Tuple<int, int> key = new Tuple<int, int>(currentComponentY, currentComponentX);
         if (components.ContainsKey(key)){
             BasicView v = components[key];
             try{
                 v.OnMouseMoved(new BasicMouseEventArgs(e, xpos[currentComponentX], ypos[currentComponentY],
                     widths[currentComponentX], heights[currentComponentY]));
             } catch (Exception){}
         }
     }
 }
Exemplo n.º 40
0
 public override void OnMouseWheel(BasicMouseEventArgs e)
 {
     int indX;
     int indY;
     BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY);
     v?.OnMouseWheel(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY]));
 }