private void valueRepresenter_MouseMove_Hand(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { ValueRepresenter repr = sender as ValueRepresenter; Point pt = e.GetPosition(repr); double PositionX_new = pt.X; UInt64 deltaTime = (UInt64)Math.Abs(core.ScaleManager.Delta(PositionX_new, PositionX)); if (PositionX_new > PositionX) { if (deltaTime < StartTime) { UInt64 newPos = StartTime - deltaTime; core.ScaleManager.VisibleStartTime = newPos; } else { core.ScaleManager.VisibleStartTime = 0; } } else { UInt64 newPos = Math.Min(StartTime + deltaTime, core.ScaleManager.EndTime - core.ScaleManager.VisibleTimeDiapasone); core.ScaleManager.VisibleStartTime = newPos; } } }
private void valueRepresenter_MouseLeftButtonDown_Hand(object sender, MouseButtonEventArgs e) { ValueRepresenter repr = sender as ValueRepresenter; Point pt = e.GetPosition(repr); PositionX = pt.X; StartTime = core.ScaleManager.VisibleStartTime; }
private void valueRepresenter_MouseDoubleClick_Cursor(object sender, MouseButtonEventArgs e) { ValueRepresenter repr = sender as ValueRepresenter; if (core.ScaleManager.EndTime != 0) { cursorViewer.Selection = new Selection(core.ScaleManager.StartTime, core.ScaleManager.EndTime, repr.Variable); e.Handled = true; } }
private void valueRepresenter_MouseLeftButtonDown_Cursor(object sender, MouseButtonEventArgs e) { ValueRepresenter repr = sender as ValueRepresenter; if (core.ScaleManager.EndTime == 0) { return; } Point pt = e.GetPosition(repr); UInt64 time = core.ScaleManager.GetTime(pt.X); Selection sel = new Selection(time, time, repr.Variable); cursorViewer.Selection = sel; }
private void valueRepresenter_MouseMove_Cursor(object sender, MouseEventArgs e) { if (core.ScaleManager.EndTime == 0) { return; } ValueRepresenter repr = sender as ValueRepresenter; if ((e.LeftButton == MouseButtonState.Pressed) && (cursorViewer.Selection != null) && (cursorViewer.Selection.End != core.ScaleManager.EndTime) && (cursorViewer.Selection.Start != core.ScaleManager.StartTime)) { Point pt = e.GetPosition(repr); UInt64 time = core.ScaleManager.GetTime(pt.X); cursorViewer.Selection.X2 = time; } }
private void valueRepresenter_MouseMove_Measure(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { ValueRepresenter repr = sender as ValueRepresenter; Point pt = e.GetPosition(repr); Point ptr = e.GetPosition(ListViewMain); double PositionX = pt.X; marker2 = repr.GetNearestMarker(PositionX); if (marker2 == null) { marker2 = new TimeMarker(core.ScaleManager.GetTime(PositionX), PositionX); } LineMarker2.X1 = LineMarker2.X2 = ptr.X - PositionX + marker2.Offset; LineMarker2.Y1 = LineCursor.Y1; LineMarker2.Y2 = LineCursor.Y2; } }
private void valueRepresenter_MouseLeftButtonDown_Measure(object sender, MouseButtonEventArgs e) { LineCursor.Visibility = System.Windows.Visibility.Collapsed; LineMarker1.Visibility = System.Windows.Visibility.Visible; LineMarker2.Visibility = System.Windows.Visibility.Visible; ValueRepresenter repr = sender as ValueRepresenter; repr1 = repr; Point pt = e.GetPosition(repr); Point ptr = e.GetPosition(ListViewMain); double PositionX = pt.X; marker1 = repr.GetNearestMarker(PositionX); if (marker1 == null) { marker1 = new TimeMarker(core.ScaleManager.GetTime(PositionX), PositionX); } LineMarker1.X1 = LineMarker1.X2 = ptr.X - PositionX + marker1.Offset; LineMarker1.Y1 = LineCursor.Y1; LineMarker1.Y2 = LineCursor.Y2; }
private void valueRepresenter_MouseLeftButtonUp_Cursor(object sender, MouseButtonEventArgs e) { if (core.ScaleManager.EndTime == 0) { return; } ValueRepresenter repr = sender as ValueRepresenter; if ((cursorViewer.Selection != null) && (cursorViewer.Selection.End != core.ScaleManager.EndTime) && (cursorViewer.Selection.Start != core.ScaleManager.StartTime)) { Point pt = e.GetPosition(repr); UInt64 time = core.ScaleManager.GetTime(pt.X); cursorViewer.Selection.X2 = time; //если выделенная область слишком мала, то она обнуляется if (cursorViewer.Selection.TimeInterval <= core.ScaleManager.MinimumVisibleChange) { cursorViewer.Selection = null; } } }
private void valueRepresenter_MouseLeftButtonUp_Measure(object sender, MouseButtonEventArgs e) { LineCursor.Visibility = System.Windows.Visibility.Visible; LineMarker1.Visibility = System.Windows.Visibility.Collapsed; LineMarker2.Visibility = System.Windows.Visibility.Collapsed; ValueRepresenter repr = sender as ValueRepresenter; repr2 = repr; Point pt = e.GetPosition(repr); Point ptr = e.GetPosition(ListViewMain); double PositionX = pt.X; marker2 = repr.GetNearestMarker(PositionX); if (marker2 == null) { marker2 = new TimeMarker(core.ScaleManager.GetTime(PositionX), PositionX); } TimeMeasureDataView1.Visibility = Visibility.Visible; if (marker1.Time != marker2.Time) { core.TimeMeasureList.Add(new TimeMeasureData(marker1, marker2, repr1.Variable, repr2.Variable)); } }