private void buttonOK_Click(object sender, EventArgs e) { decimal begin = 0M, end = 0M; bool checkBegin = false, checkEnd = false; if (radioBeginSec.Checked) { begin = numBeginSec.Value; checkBegin = true; } else if (radioBeginFrame.Checked) { begin = _timeController.GetTimeFromIndex((int)numBeginFrame.Value); checkBegin = true; } if (radioEndSec.Checked) { end = numEndSec.Value; checkEnd = true; } else if (radioEndFrame.Checked) { end = _timeController.GetTimeFromIndex((int)numEndFrame.Value); checkEnd = true; } if (checkBegin && checkEnd) { _timeController.SelectRange(begin, end); } else if (checkBegin) { if (_timeController.IsSelecting) { _timeController.SelectRange(begin, _timeController.SelectEndTime); } else { _timeController.SelectRange(begin, _timeController.EndTime); } } else if (checkEnd) { if (_timeController.IsSelecting) { _timeController.SelectRange(_timeController.SelectBeginTime, end); } else { _timeController.SelectRange(_timeController.BeginTime, end); } } this.DialogResult = DialogResult.OK; }
private void TimeSelectionControl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { TimeController timeController = _timeController; if (timeController != null) { int addend = 1; if (e.Control) { addend = 8; } switch (e.KeyCode) { case Keys.Right: timeController.CurrentIndex += addend; timeController.CursorTime = timeController.CurrentTime; if (e.Shift) { timeController.AdjustSelectedRange(timeController.CurrentTime); } else { timeController.SelectRange(timeController.CurrentTime, timeController.CurrentTime); } e.IsInputKey = true; break; case Keys.Left: timeController.CurrentIndex -= addend; timeController.CursorTime = timeController.CurrentTime; if (e.Shift) { timeController.AdjustSelectedRange(timeController.CurrentTime); } else { timeController.SelectRange(timeController.CurrentTime, timeController.CurrentTime); } e.IsInputKey = true; break; case Keys.Down: this.CurrentTimeTabSize = Math.Min(this.Height / 2, this.CurrentTimeTabSize + addend); e.IsInputKey = true; break; case Keys.Up: this.CurrentTimeTabSize -= addend; e.IsInputKey = true; break; } } }
private void pictDisplay_MouseMove(object sender, MouseEventArgs e) { TimeController timeController = _timeController; if (timeController == null) { return; } decimal cursorTime = getTimeFromPosition(e.X); //cursorTime = Math.Min(timeController.VisibleEndTime, Math.Max(timeController.VisibleBeginTime, cursorTime)); timeController.CursorTime = cursorTime; RegulatedMouseInfo info = _mouse.MouseMove(e); decimal timeDelta = getTimeSpanFromDelta(_mouse.MoveDelta.X); switch (info.Button) { case RegulatedMouseButton.Left: timeController.CursorTime = cursorTime; timeController.SelectRange(Math.Min(cursorTime, _selectingTime), Math.Max(cursorTime, _selectingTime)); break; case RegulatedMouseButton.CtrlLeft: timeController.CurrentTime = cursorTime; timeController.SelectRange(Math.Min(cursorTime, _selectingTime), Math.Max(cursorTime, _selectingTime)); break; case RegulatedMouseButton.AltLeft: decimal timeOffset = timeDelta; if (!this.IsGlobalTimeLineMode) { timeOffset = -timeOffset; } timeController.SetVisibleTime(timeController.VisibleBeginTime + timeOffset, timeController.VisibleEndTime + timeOffset); break; case RegulatedMouseButton.ShiftLeft: timeController.AdjustSelectedRange(cursorTime); break; case RegulatedMouseButton.ShiftCtrlLeft: timeController.CurrentTime = cursorTime; timeController.AdjustSelectedRange(cursorTime); break; } }
private void pictDisplay_MouseDown(object sender, MouseEventArgs e) { TimeController timeController = _timeController; if (timeController == null) { return; } RegulatedMouseButton button = _mouse.MouseDown(e); decimal cursorTime = getTimeFromPosition(e.X); //cursorTime = Math.Min(timeController.VisibleEndTime, Math.Max(timeController.VisibleBeginTime, cursorTime)); _selectingTime = cursorTime; switch (button) { case RegulatedMouseButton.Left: timeController.CursorTime = cursorTime; timeController.SelectRange(Math.Min(cursorTime, _selectingTime), Math.Max(cursorTime, _selectingTime)); break; case RegulatedMouseButton.CtrlLeft: timeController.CurrentTime = cursorTime; timeController.SelectRange(Math.Min(cursorTime, _selectingTime), Math.Max(cursorTime, _selectingTime)); break; case RegulatedMouseButton.ShiftCtrlLeft: timeController.AdjustSelectedRange(cursorTime); timeController.CurrentTime = cursorTime; break; case RegulatedMouseButton.ShiftLeft: timeController.AdjustSelectedRange(cursorTime); break; } }