void TimeLine::onDragDrop (ATOM_WidgetDragDropEvent *event) { if (event->dragSource->getProperty("Type") == "KM") { unsigned numSlices = _duration / _timeSlice; unsigned width = _timeLine->getClientRect().size.w; unsigned sliceWidth = (width - numSlices - 1) / numSlices; unsigned space = (width - numSlices * (sliceWidth + 1) - 1) / 2; int x = event->x - space; int n = x / (1 + sliceWidth); if ( n < numSlices && !isKeyFrame (n)) { int source = event->dragSource->getProperty("SourceFrame").getI(); ATOM_AUTOPTR(ATOM_CompositionKeyFrameValue) keyFrameValue = _actor->createKeyFrameValue (); _actor->evalKeyFrameValue (sliceIndexToTime (source), keyFrameValue.get()); if ((event->keymod & KEYMOD_SHIFT) == 0) { removeKeyFrame (source); } addKeyFrame (n, keyFrameValue.get()); setCurrentSlice (n, 0); } } }
void TimeLine::onLButtonDown (ATOM_WidgetLButtonDownEvent *event) { unsigned numSlices = _duration / _timeSlice; unsigned width = _timeLine->getClientRect().size.w; unsigned sliceWidth = (width - numSlices - 1) / numSlices; unsigned space = (width - numSlices * (sliceWidth + 1) - 1) / 2; int x = event->x - space; int n = x / (1 + sliceWidth); if ( n < numSlices) { if (event->shiftState & KEYMOD_CTRL) { if (isKeyFrame (n)) { removeKeyFrame (n); } else { addKeyFrame (n); } } else { setCurrentSlice (n, 0); } } }
void GeneralViewer::changeCurrentSlice( int32 diff ) { setCurrentSlice( diff + getCurrentSlice() ); }