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();
     }
 }
예제 #2
0
 public BasicMouseEventArgs(BasicMouseEventArgs e, int dx, int dy, int width, int height)
 {
     X = e.X - dx;
     Y = e.Y - dy;
     Width = width;
     Height = height;
     IsMainButton = e.IsMainButton;
     controlPressed = e.controlPressed;
     showTip = e.showTip;
 }
예제 #3
0
 public BasicMouseEventArgs(BasicMouseEventArgs e, int dx, int dy, int width, int height)
 {
     X              = e.X - dx;
     Y              = e.Y - dy;
     Width          = width;
     Height         = height;
     IsMainButton   = e.IsMainButton;
     controlPressed = e.controlPressed;
     showTip        = e.showTip;
 }
 // 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();
 }
 // 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();
 }
 public override void OnMouseIsDown(BasicMouseEventArgs e)
 {
     ScrollBarState newState = ScrollBarState.Neutral;
     bool ctrl = e.ControlPressed;
     if (e.Y < GraphUtil.scrollBarWidth - 1){
         if (ctrl){
             newState = ScrollBarState.PressFirstBox;
             MoveUp(main.DeltaUpToSelection());
         } else{
             newState = ScrollBarState.PressFirstBox;
             MoveUp(main.DeltaY());
             upThread = new Thread(() => WalkUp(main.DeltaY()));
             upThread.Start();
         }
     } else if (e.Y > e.Height - GraphUtil.scrollBarWidth){
         if (ctrl){
             newState = ScrollBarState.PressSecondBox;
             MoveDown(main.DeltaDownToSelection());
         } else{
             newState = ScrollBarState.PressSecondBox;
             MoveDown(main.DeltaY());
             downThread = new Thread(() => WalkDown(main.DeltaY()));
             downThread.Start();
         }
     } else if (HasBar){
         int s = CalcBarStart(e.Height);
         int l = CalcBarSize(e.Height);
         if (e.Y >= s && e.Y <= s + l){
             newState = ScrollBarState.PressBar;
             dragStart = e.Y;
             visibleDragStart = main.VisibleY;
         } else if (e.Y < s){
             MoveUp((int) (main.VisibleHeight / main.ZoomFactor));
             upThread = new Thread(() => WalkUp((int) (main.VisibleHeight / main.ZoomFactor)));
             upThread.Start();
         } else{
             MoveDown((int) (main.VisibleHeight / main.ZoomFactor));
             downThread = new Thread(() => WalkDown((int) (main.VisibleHeight / main.ZoomFactor)));
             downThread.Start();
         }
     }
     if (newState != state){
         state = newState;
         Invalidate();
     }
 }
예제 #7
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();
 }
예제 #8
0
 public override void OnMouseIsUp(BasicMouseEventArgs e)
 {
     if (Configurable && !e.IsMainButton){
         NumericAxisPropertiesForm f = new NumericAxisPropertiesForm(Text, IsLogarithmic ? Math.Exp(ZoomMin) : ZoomMin,
             IsLogarithmic ? Math.Exp(ZoomMax) : ZoomMax);
         f.ShowDialog();
         if (f.Ok){
             Text = f.Title;
             double newMin = IsLogarithmic ? Math.Log(f.MinValue) : f.MinValue;
             double newMax = IsLogarithmic ? Math.Log(f.MaxValue) : f.MaxValue;
             if (!double.IsNaN(newMin) && !double.IsNaN(newMax) && newMin < newMax){
                 ZoomMin = newMin;
                 ZoomMax = newMax;
                 TotalMin = newMin;
                 TotalMax = newMax;
                 FireZoomChanged();
                 Invalidate();
             }
         }
         f.Dispose();
         return;
     }
     if (!IsValid()){
         return;
     }
     if (e.IsMainButton){
         if (ZoomType == AxisZoomType.None){
             return;
         }
         switch (MouseMode){
             case AxisMouseMode.Zoom:
                 SetZoomFromView((int) GetMinIndicator(GetLength(e.Width, e.Height)),
                     (int) GetMaxIndicator(GetLength(e.Width, e.Height)), GetLength(e.Width, e.Height));
                 break;
             case AxisMouseMode.Move:
                 switch (ZoomType){
                     case AxisZoomType.Indicate:
                         if (IsFullZoom()){
                             return;
                         }
                         FireZoomChanged();
                         break;
                     case AxisZoomType.Zoom:
                         if (IsFullZoom()){
                             return;
                         }
                         if (indicator1 == indicator2){
                             Center(e);
                             FireZoomChanged();
                             break;
                         }
                         Invalidate();
                         FireZoomChanged();
                         break;
                 }
                 break;
         }
         indicator1 = -1;
         indicator2 = -1;
     }
 }
예제 #9
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);
     }
 }
예제 #10
0
 public override void OnMouseDragged(BasicMouseEventArgs e)
 {
     if (!IsValid() || ZoomType == AxisZoomType.None){
         return;
     }
     indicator2 = IsHorizontal() ? e.X : e.Y;
     indicator2 = Math.Max(0, indicator2);
     indicator2 = Math.Min(GetLength(e.Width, e.Height), indicator2);
     switch (MouseMode){
         case AxisMouseMode.Zoom:
             Invalidate();
             break;
         case AxisMouseMode.Move:
             switch (ZoomType){
                 case AxisZoomType.Indicate:
                     Center(e);
                     break;
                 case AxisZoomType.Zoom:
                     if (IsFullZoom()){
                         return;
                     }
                     double current = ViewToModel(IsHorizontal() ? e.X : e.Y, e.Width, e.Height);
                     double delta = current - dragStart;
                     ZoomMin -= delta;
                     ZoomMax -= delta;
                     MoveZoomIntoRange();
                     Invalidate();
                     break;
             }
             break;
     }
 }
예제 #11
0
 public 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();
     }
 }
 public 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();
 }
 public override void OnMouseIsUp(BasicMouseEventArgs e)
 {
     main.OnMouseIsUpMainView?.Invoke(e);
 }
 public override void OnMouseDragged(BasicMouseEventArgs e)
 {
     main.OnMouseDraggedMainView?.Invoke(e);
 }
 public override void OnMouseIsUp(BasicMouseEventArgs e)
 {
     main.OnMouseIsUpColumnFooterView?.Invoke(e);
 }
 public override void OnMouseDragged(BasicMouseEventArgs e)
 {
     main.OnMouseDraggedColumnFooterView?.Invoke(e);
 }
 public override void OnMouseIsDown(BasicMouseEventArgs e)
 {
     main.OnMouseIsDownRowHeaderView?.Invoke(e);
 }
 public override void OnMouseClick(BasicMouseEventArgs e)
 {
     main.OnMouseClickCornerView?.Invoke(e);
 }
 public override void OnMouseIsDown(BasicMouseEventArgs e)
 {
     main.OnMouseIsDownColumnSpacerView?.Invoke(e);
 }
예제 #21
0
 public override void OnMouseIsUp(BasicMouseEventArgs e)
 {
     if (!hasMoved){
         if (e.IsMainButton){
             ColorDialog cd = new ColorDialog();
             if (cd.ShowDialog() == DialogResult.OK){
                 if (mouseOverIndex != -1){
                     Colors[mouseOverIndex] = Color2.FromArgb(cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B);
                 } else{
                     Colors.Add(Color2.FromArgb(cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B));
                     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;
 }
 public override void OnMouseDoubleClick(BasicMouseEventArgs e)
 {
     main.OnMouseDoubleClickColumnHeaderView?.Invoke(e);
 }
 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();
 }
예제 #24
0
 public override void OnMouseIsDown(BasicMouseEventArgs e)
 {
     mouseDragIndex = mouseOverIndex;
     mouseStartPos = Vertical ? e.Y : e.X;
     hasMoved = false;
 }
 public override void OnMouseDoubleClick(BasicMouseEventArgs e)
 {
     main.OnMouseDoubleClickRowSpacerView?.Invoke(e);
 }
 public override void OnMouseMoved(BasicMouseEventArgs e)
 {
     main.OnMouseMoveMiddleCornerView?.Invoke(e);
 }
 public override void OnMouseMoved(BasicMouseEventArgs e)
 {
     main.OnMouseMoveRowSpacerView?.Invoke(e);
 }
예제 #28
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;
     }
 }
 public override void OnMouseMoved(BasicMouseEventArgs e)
 {
     main.OnMouseMoveColumnHeaderView?.Invoke(e);
 }
예제 #30
0
 public 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();
         }
     }
 }