Ejemplo n.º 1
0
Archivo: Cursor.cs Proyecto: rbua/JILK
 public void ForcedMoveDown(object sender, CursorEventArgs e)
 {
     CursorPosition = new Point(
         CursorPosition.X,
         CursorPosition.Y + 9,
         0);
 }
Ejemplo n.º 2
0
        public override void OnCursorClick(object sender, CursorEventArgs eventArgs)
        {
            var relativePosition = new Point(
                eventArgs.CursorOnScreenPosition.X - RelatedWindow.Position.X,
                eventArgs.CursorOnScreenPosition.Y - RelatedWindow.Position.Y,
                0);

            if (relativePosition.Y == 1)
            {
                if (relativePosition.X == 2)
                {
                    RelatedWindow.OnClose();
                    // After OnClose invocation related window shall be closed, so user will see the following text
                    // only in case when window is not closed
                    RelatedWindow.Title += " At least one window should be on the surface";
                }
                if (relativePosition.X == 5)
                {
                    // TODO: Minimizing
                    RelatedWindow.Title += " Maximizing is unavailable at this moment.";
                }
                if (relativePosition.X == 8)
                {
                    // TODO: Maximizing
                    RelatedWindow.Title += " Minimizing is unavailable at this moment.";
                }
            }
        }
Ejemplo n.º 3
0
        private void chartZ_SelectionRangeChanged(object sender, CursorEventArgs e)
        {
            var xRangeStart = e.Axis.ScaleView.ViewMinimum;
            var xRangeEnd   = e.Axis.ScaleView.ViewMaximum;

            AutoScaleYAxisWhenXAxisZoomed(chartZ, xRangeStart, xRangeEnd);
        }
Ejemplo n.º 4
0
        private void SelectionChange(object sender, CursorEventArgs e)
        {
            SelectionStart = e.NewSelectionStart;
            SelectionEnd   = e.NewSelectionEnd;

            lblSelection.Text = $"Selection: {SelectionStart} - {SelectionEnd} ({FormatTime(SelectionStart, SelectionEnd)})";
        }
Ejemplo n.º 5
0
 private void Cursor_CursorDeactivated(object sender, CursorEventArgs e)
 {
     cursor.CursorDeactivated -= Cursor_CursorDeactivated;
     isGrabbing = false;
     transform.SetParent(originalParent);
     originalParent = null;
 }
Ejemplo n.º 6
0
        private void chart1_CursorPositionChanging(object sender, CursorEventArgs e)
        {
            int N = chart1.Series[0].Points.Count;

            if (N == 0)
            {
                return;
            }
            if (e.Axis.AxisName == AxisName.X)
            {
                int xindex = GetPointIndex(e.NewPosition);
                e.NewPosition = chart1.Series[0].Points[xindex].XValue;
                lX.Text       = e.NewPosition.ToString("f01");
            }
            if (e.Axis.AxisName == AxisName.Y)
            {
                double x = e.ChartArea.CursorX.Position;
                for (int i = 0; i < N; i++)
                {
                    if (x == chart1.Series[0].Points[i].XValue)
                    {
                        e.NewPosition = chart1.Series[0].Points[i].YValues[0];
                        lY.Text       = e.NewPosition.ToString();
                        return;
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// keeps track of the latest frequency bins that
        /// have been selected. flips the selection to the
        /// corresponding bin if they select past the
        /// nyquist limit (midway point of the bar chart).
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FilterSelected(object sender, CursorEventArgs e)
        {
            if (frequencies == null)
            {
                return;
            }
            filterStart = (int)e.NewSelectionStart;
            filterEnd   = (int)e.NewSelectionEnd;

            if (filterEnd > frequencies.Length / 2)
            {
                filterEnd = frequencies.Length / 2;
            }
            if (filterStart > frequencies.Length / 2)
            {
                filterStart = filterStart - frequencies.Length / 2;
            }

            if (filterDiff < 0)
            {
                int temp = filterEnd;
                filterEnd   = filterStart;
                filterStart = temp;
            }
            filterDiff = filterEnd - filterStart;

            if (filterStart == 0)
            {
                filterStart++;
            }
            if (filterEnd < filterStart)
            {
                filterEnd = filterStart;
            }
        }
Ejemplo n.º 8
0
Archivo: Cursor.cs Proyecto: rbua/JILK
 public void MoveLeft(object sender, CursorEventArgs e)
 {
     CursorPosition = new Point(
         CursorPosition.X - 1,
         CursorPosition.Y,
         CursorPosition.Z);
 }
Ejemplo n.º 9
0
Archivo: Cursor.cs Proyecto: rbua/JILK
 public void MoveUp(object sender, CursorEventArgs e)
 {
     CursorPosition = new Point(
         CursorPosition.X,
         CursorPosition.Y - 1,
         0);
 }
Ejemplo n.º 10
0
        /**
         * Selection dragging on the X axis will update the summary to be current selection.
         */
        private void NetworkChart_SelectionRangeChanged(object sender, CursorEventArgs e)
        {
            if ((CurrentNetworkStream == null) || (CurrentNetworkStream.Frames.Count == 0))
            {
                return;
            }

            if (e.NewSelectionEnd - e.NewSelectionStart < 1)
            {
                return;                 // Single click, ignore, handled above
            }

            if (e.Axis.AxisName == AxisName.X)
            {
                ActorPerfPropsDetailsListView.Items.Clear();

                RangeSelectStart = Math.Max(0, ( int )NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.ViewMinimum);
                RangeSelectEnd   = Math.Min(CurrentNetworkStream.Frames.Count, ( int )NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.ViewMaximum);

                CancelSelectRangeThread();

                SelectRangeThread = new Thread(() => SelectRangeWorker(RangeSelectStart, RangeSelectEnd));
                SelectRangeThread.Start();
            }
        }
Ejemplo n.º 11
0
Archivo: Cursor.cs Proyecto: rbua/JILK
 public void ForcedMoveRight(object sender, CursorEventArgs e)
 {
     CursorPosition = new Point(
         CursorPosition.X + 18,
         CursorPosition.Y,
         0);
 }
Ejemplo n.º 12
0
        private void chart1_SelectionRangeChanging(object sender, CursorEventArgs e)
        {
            double SelectionSize_new = e.NewSelectionEnd - e.NewSelectionStart;

            if (SelectionSize_new != 0 || SelectionSize != 0 && SelectionSize_new == 0)
            {
                mouse_click_block = true;
            }
            SelectionSize = SelectionSize_new;
            pr("SelectionRangeChanging: " + SelectionSize.ToString());
            if (SelectionSize == 0)
            {
                prs("");
            }
            else
            {
                string msg = string.Format("Смещение: {0}", ((int)SelectionSize).ToString());
                int    pos = (int)e.NewSelectionEnd;
                if (pos >= 0 && pos < miu.Length)
                {
                    msg += string.Format(" I={0} {1}={2}",
                                         miu[pos].I.ToString(),
                                         DescValIU,
                                         miu[pos].Val(ValIU).ToString()
                                         );
                }
                prs(msg);
            }
        }
Ejemplo n.º 13
0
 private void Cursor_CursorActivated(object sender, CursorEventArgs e)
 {
     cursor.CursorDeactivated += Cursor_CursorDeactivated;
     isGrabbing     = true;
     originalParent = transform.parent;
     transform.SetParent(cursor.transform);
 }
Ejemplo n.º 14
0
 private void chartMain_SelectionRangeChanged(object sender, CursorEventArgs e)
 {
     if ((e.NewSelectionStart > 0 && Math.Abs(e.NewSelectionEnd - e.NewSelectionStart) > MinimumZoom) ||
         (e.NewSelectionStart == 0 && e.NewSelectionEnd == 0))
     {
         ShowDataRange((int)e.NewSelectionStart, (int)e.NewSelectionEnd);
     }
 }
Ejemplo n.º 15
0
 private void Cursor_CursorDeactivated(object sender, CursorEventArgs e)
 {
     if (spawnedItem != null)
     {
         Destroy(spawnedItem.GetComponent <OnePointMove>());
     }
     cursor = null;
 }
Ejemplo n.º 16
0
 public override void OnPressedCursorMoveUp(object sender, CursorEventArgs eventArgs)
 {
     RelatedWindow.Position = new Point(
         RelatedWindow.Position.X,
         RelatedWindow.Position.Y - 1,
         RelatedWindow.Position.Z);
     base.OnPressedCursorMoveUp(sender, eventArgs);
 }
Ejemplo n.º 17
0
 private void nodesChart_SelectionRangeChanged(object sender, CursorEventArgs e)
 {
     this.viewModel.NodeReportPane.Selection = new DateSelection()
     {
         StartDate = DateTime.FromOADate(Math.Min(e.NewSelectionStart, e.NewSelectionEnd)),
         EndDate   = DateTime.FromOADate(Math.Max(e.NewSelectionStart, e.NewSelectionEnd))
     };
 }
Ejemplo n.º 18
0
        //用来设置切换视图时的视角

        private void chart_SelectionRangeChanged(object sender, CursorEventArgs e)

        {
            //无数据时返回

            if (chart.Series[0].Points.Count == 0)
            {
                return;
            }

            double start_position = 0.0;

            double end_position = 0.0;

            double myInterval = 0.0;

            start_position = e.NewSelectionStart;

            end_position = e.NewSelectionEnd;

            myInterval = Math.Abs(start_position - end_position);

            if (myInterval == 0.0)
            {
                return;
            }

            //X轴视图起点

            chart.ChartAreas[0].AxisX.ScaleView.Position = Math.Min(start_position, end_position);

            //X轴视图长度

            chart.ChartAreas[0].AxisX.ScaleView.Size = myInterval;

            //X轴间隔

            if (myInterval < 11.0)

            {
                chart.ChartAreas[0].AxisX.Interval = 1;
            }
            else

            {
                chart.ChartAreas[0].AxisX.Interval = Math.Floor(myInterval / 10);
            }

            flag = true;

            if (!comboBox1.Items.Contains("Zoom"))

            {
                comboBox1.Items.Add("Zoom");

                comboBox1.SelectedItem = "Zoom";
            }
        }
        //private void comboBox1_CursorChanged(object sender, EventArgs e)
        //{


        //}

        private void Chart1OnCursorPositionChanged(object sender, CursorEventArgs cursorEventArgs)
        {
            if (double.IsNaN(cursorEventArgs.NewPosition))
            {
                Debug.WriteLine("nan");
                return;
            }

            Debug.WriteLine(DateTime.FromOADate(cursorEventArgs.NewPosition));
        }
Ejemplo n.º 20
0
 private void Chart_CursorPositionChanged(object sender, CursorEventArgs e)
 {
     if (LoadingLog || PlottingLog)
     {
         return;
     }
     if (LogEntries != null && e.Axis == this.chart.ChartAreas[0].AxisX)
     {
         SetCursorPosition(e.NewPosition);
     }
 }
Ejemplo n.º 21
0
        private void diagChart_CursorPositionChanging(object sender, CursorEventArgs e)
        {
            if (double.IsNaN(e.NewPosition))
            {
                return;
            }

            var index = (int)e.NewPosition;

            UpdateCursorValue(index - 1);
        }
Ejemplo n.º 22
0
 private void onCursorEvent(CursorCommandCodes CursorCommand, int Row, int Col)
 {
     if (CursorEvent != null)
     {
         CursorEventArgs e = new CursorEventArgs();
         e.CursorCommand = CursorCommand;
         e.Row           = Row;
         e.Col           = Col;
         CursorEvent(this, e);
     }
 }
Ejemplo n.º 23
0
        void chart1_SelectionRangeChanged(object sender, CursorEventArgs e)
        {
            var axisY = this.chart1.ChartAreas["ChartArea1"].AxisY;

            var xRangeStart = e.Axis.ScaleView.ViewMinimum;
            var xRangeEnd   = e.Axis.ScaleView.ViewMaximum;

            // compute the Y values for the points crossing the range edges
            double?yRangeStart           = null;
            var    pointBeforeRangeStart = this.chart1.Series[0].Points.FirstOrDefault(x => x.XValue <= xRangeStart);
            var    pointAfterRangeStart  = this.chart1.Series[0].Points.FirstOrDefault(x => x.XValue > xRangeStart);

            if (pointBeforeRangeStart != null && pointAfterRangeStart != null)
            {
                yRangeStart = Interpolate2Points(pointBeforeRangeStart, pointAfterRangeStart, xRangeStart);
            }

            double?yRangeEnd           = null;
            var    pointBeforeRangeEnd = this.chart1.Series[0].Points.FirstOrDefault(x => x.XValue <= xRangeEnd);
            var    pointAfterRangeEnd  = this.chart1.Series[0].Points.FirstOrDefault(x => x.XValue > xRangeEnd);

            if (pointBeforeRangeEnd != null && pointAfterRangeEnd != null)
            {
                yRangeEnd = Interpolate2Points(pointBeforeRangeEnd, pointAfterRangeEnd, xRangeEnd);
            }

            var edgeValues = new[] { yRangeStart, yRangeEnd }.Where(x => x.HasValue).Select(x => x.Value);

            // find the points inside the range
            var valuesInRange = this.chart1.Series["Series1"].Points
                                .Where(p => p.XValue >= xRangeStart && p.XValue <= xRangeEnd)
                                .Select(x => x.YValues[0]);

            // find the minimum and maximum Y values
            var    values = valuesInRange.Concat(edgeValues);
            double yMin;
            double yMax;

            if (values.Any())
            {
                yMin = values.Min();
                yMax = values.Max();
            }
            else
            {
                yMin = this.chart1.Series["Series1"].Points.Min(x => x.YValues[0]);
                yMax = this.chart1.Series["Series1"].Points.Max(x => x.YValues[0]);
            }

            // zoom Y-axis to [yMin - yMax]
            axisY.ScaleView.Zoom(yMin, yMax);
        }
Ejemplo n.º 24
0
 private void OnPerformanceCursorPositionChanged(object sender, CursorEventArgs e)
 {
     if (chPerformance.Series.Count > 0 && _currentRecords.Count > 0)
     {
         var index = _currentRecords.FindIndex(p => p.Value16.ToOADate() >= e.NewPosition);
         if (_lastPointIndex != index && index >= 0)
         {
             _lastPointIndex = index;
             SetPerformanceInfo();
         }
         Debug.WriteLine(e.NewPosition);
     }
 }
Ejemplo n.º 25
0
    private void Cursor_CursorDeactivated(object sender, CursorEventArgs e)
    {
        var cursor = sender as HandCursor;

        cursor.CursorDeactivated -= Cursor_CursorDeactivated;

        ActiveCursors.Remove(cursor);

        SendMessage("CursorDeactivate", new CursorEventArgs()
        {
            Sender = this, Cursor = cursor
        }, SendMessageOptions.DontRequireReceiver);
    }
Ejemplo n.º 26
0
 private void Chart1SelectionRangeChanging(object sender, CursorEventArgs e)
 {
     if (e.Axis.AxisName == AxisName.X)
     {
         if (Math.Abs(e.NewSelectionEnd - e.NewSelectionStart) < .03 * (e.ChartArea.AxisX.ScaleView.ViewMaximum -
                                                                        e.ChartArea.AxisX.ScaleView.ViewMinimum)
             //||(Math.Abs(e.NewSelectionEnd - e.NewSelectionStart) < ScaleXMin)
             )
         {
             e.NewSelectionEnd = e.NewSelectionStart;
         }
     }
 }
Ejemplo n.º 27
0
    void CursorDeactivate(CursorEventArgs e)
    {
        switch (e.Sender.ActiveCursors.Count)
        {
        case 1:
            DestroyImmediate(twoPointComp);
            addOnePoint(e.Sender.ActiveCursors[0].transform);
            break;

        case 0:
            DestroyImmediate(onePointComp);
            break;
        }
    }
Ejemplo n.º 28
0
        private void Chart1_CursorPositionChanged(object sender, CursorEventArgs e)
        {
            chart2.ChartAreas[0].AxisX.ScaleView          = chart1.ChartAreas[0].AxisX.ScaleView;
            chart2.ChartAreas[0].AxisX.Interval           = chart1.ChartAreas[0].AxisX.Interval;
            chart2.ChartAreas[0].IsSameFontSizeForAllAxes = chart1.ChartAreas[0].IsSameFontSizeForAllAxes;
            chart2.ChartAreas[0].CursorX = chart1.ChartAreas[0].CursorX;

            chart3.ChartAreas[0].AxisX.ScaleView          = chart1.ChartAreas[0].AxisX.ScaleView;
            chart3.ChartAreas[0].AxisX.Interval           = chart1.ChartAreas[0].AxisX.Interval;
            chart3.ChartAreas[0].IsSameFontSizeForAllAxes = chart1.ChartAreas[0].IsSameFontSizeForAllAxes;
            chart3.ChartAreas[0].CursorX = chart1.ChartAreas[0].CursorX;
            SetChart1();
            SetChart2();
            SetChart3();
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Moves the selection on the opposite time domain to the same position as the active one.
 /// </summary>
 /// <param name="sender">The time domain channel that is calling the event handler (Left or Right channel).</param>
 /// <param name="e">Unused.</param>
 private void MoveSelection(object sender, CursorEventArgs e)
 {
     if (sender == this.LTimeChannel.Chart)
     {
         this.RTimeChannel.ChartArea.CursorX.SelectionStart = this.LTimeChannel.ChartArea.CursorX.SelectionStart;
         this.RTimeChannel.ChartArea.CursorX.SelectionEnd   = this.LTimeChannel.ChartArea.CursorX.SelectionEnd;
         this.RTimeChannel.ChartArea.CursorX.Position       = this.LTimeChannel.ChartArea.CursorX.Position;
     }
     else
     {
         this.LTimeChannel.ChartArea.CursorX.SelectionStart = this.RTimeChannel.ChartArea.CursorX.SelectionStart;
         this.LTimeChannel.ChartArea.CursorX.SelectionEnd   = this.RTimeChannel.ChartArea.CursorX.SelectionEnd;
         this.LTimeChannel.ChartArea.CursorX.Position       = this.RTimeChannel.ChartArea.CursorX.Position;
     }
 }
Ejemplo n.º 30
0
    void CursorActivate(CursorEventArgs e)
    {
        if (!isReady)
        {
            return;
        }

        activeCursor = e.Cursor;

        var loader = Instantiate(ContentLoaderPrefab);

        loader.transform.position = e.Cursor.Cursor.transform.position;
        loader.transform.LookAt(Camera.main.transform);
        loader.GetComponent <ContentLoader>().RequestContent(SocketId, activeCursor);
    }
 private void chartMain_SelectionRangeChanged(object sender, CursorEventArgs e)
 {
     if ((e.NewSelectionStart > 0 && Math.Abs(e.NewSelectionEnd - e.NewSelectionStart) > MinimumZoom)
         || (e.NewSelectionStart == 0 && e.NewSelectionEnd == 0))
     {
         ShowDataRange((int)e.NewSelectionStart, (int)e.NewSelectionEnd);
     }
 }
Ejemplo n.º 32
0
 private void OnPaletteSelectionChanged(CursorEventArgs args)
 {
     if (PaletteSelectionChanged != null) {
         PaletteSelectionChanged(this, args);
     }
 }
Ejemplo n.º 33
0
 void mModel_OnCursorChange(object sender, CursorEventArgs e)
 {
     this.RaiseOnCursorChange(e.Cursor);
 }
Ejemplo n.º 34
0
 void mView_OnCursorChange(object sender, CursorEventArgs e)
 {
     this.Cursor = e.Cursor;
 }