/* (non-Javadoc)
  * @see de.artcom.timeline.controller.TimeRangeController#mouseDragged(java.awt.event.MouseEvent)
  */
 @Override
 public void mouseDragged(MouseEvent e) {
   super.mouseDragged(e);
   boolean _myPressedShift =
       (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) == MouseEvent.SHIFT_DOWN_MASK;
   if (_myPressedShift) {
     switch (_myLoopAction) {
       case MOVE_END:
         _myTrackDataController
             .trackData()
             .scaleRange(_myLoopStart, _myLoopEnd, _myNewLoopStart, _myNewLoopEnd);
         break;
       case MOVE_BOTH:
         if (_myMoveList == null) break;
         for (ControlPoint myPoint : _myMoveList) {
           _myTrackDataController
               .trackData()
               .move(
                   myPoint,
                   new ControlPoint(
                       myPoint.time() + (_myNewLoopStart - _myLoopStart), myPoint.value()));
         }
         break;
       default:
         break;
     }
   }
 }
  public void replace() {
    if (_myLastSelection.size() == 0) {
      return;
    }
    TrackData myModel = _myTrackDataController.trackData();

    double myRange = _myLastUpperBound - _myLastLowerBound;
    ArrayList<ControlPoint> myInsertion = prepareInsertion(_myTimeRange.start(), myRange, myModel);

    myModel.replaceAll(_myTimeRange.start(), myRange, myInsertion);
    _myTrackDataController.view().render();
  }
  public void insert() {
    if (_myLastSelection.size() == 0) {
      return;
    }

    TrackData myModel = _myTrackDataController.trackData();

    ArrayList<ControlPoint> myInsertion = prepareInsertion(_myTimeRange.start(), 0, myModel);

    // insert last selection at lower bound of current selection
    myModel.insertAll(_myTimeRange.start(), _myTimeRange.range(), myInsertion);
    _myTrackDataController.view().render();
  }
  public void cut() {
    copy();

    TrackData myTrackData = _myTrackDataController.trackData();

    ArrayList<ControlPoint> myRange =
        myTrackData.copyRange(_myTimeRange.start(), _myTimeRange.end());
    myTrackData.removeAll(_myTimeRange.start(), _myTimeRange.end());

    UndoHistory.instance()
        .apply(new CutAction(_myTrackDataController, myRange, _myTimeRange.clone()));
    _myTrackDataController.view().render();
  }
  public void copy() {
    TrackData myTrackData = _myTrackDataController.trackData();

    //		double myLowValue = myTrackData.getValue(_myTimeRange.start());
    //		double myHighValue = myTrackData.getValue(_myTimeRange.end());

    ArrayList<ControlPoint> myRange =
        myTrackData.copyRange(_myTimeRange.start(), _myTimeRange.end());
    _myLastSelection = new ArrayList<ControlPoint>();
    _myLastLowerBound = _myTimeRange.start();
    _myLastUpperBound = _myTimeRange.end();
    //		_myLastSelection.add(new ControlPoint(_myTimeRange.start(), myLowValue));
    _myLastSelection.addAll(myRange);
    //		_myLastSelection.add(new ControlPoint(_myTimeRange.end(), myHighValue));
  }
  /* (non-Javadoc)
   * @see de.artcom.timeline.controller.TimeRangeController#mousePressed(java.awt.event.MouseEvent)
   */
  @Override
  public void mousePressed(MouseEvent e) {
    super.mousePressed(e);

    _myMoveList = null;

    boolean _myPressedShift =
        (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) == MouseEvent.SHIFT_DOWN_MASK;
    if (_myPressedShift) {
      switch (_myLoopAction) {
        case MOVE_BOTH:
          _myMoveList = _myTrackDataController.trackData().rangeList(_myLoopStart, _myLoopEnd);
          break;
        default:
          break;
      }
    }
  }
 public void cutTime(TrackView theTimelinePanel) {
   TrackData myModel = _myTrackDataController.trackData();
   _myLastSelection = myModel.copyRange(_myTimeRange.start(), _myTimeRange.end());
   myModel.cutRange(_myTimeRange.start(), _myTimeRange.end());
   _myTrackDataController.view().render();
 }