void ofxTimeline::keyPressed(ofKeyEventArgs& args){ if( !isShowing ) return; // bail if we are hidden // cout << "key event " << args.key << " ctrl? " << ofGetModifierKeyControl() << endl; if(ofGetModifierKeyControl() && args.key == 3){ //copy string copyattempt = currentPage->copyRequest(); if(copyattempt != ""){ pasteboard = copyattempt; } } else if(ofGetModifierKeyControl() && args.key == 24){ //cut string copyattempt = currentPage->cutRequest(); if(copyattempt != ""){ pasteboard = copyattempt; } } else if(ofGetModifierKeyControl() && args.key == 22){ //paste if (pasteboard != "") { currentPage->pasteSent(pasteboard); } } else if(ofGetModifierKeyControl() && args.key == 1){ //select all currentPage->selectAll(); } else{ if(args.key >= OF_KEY_LEFT && args.key <= OF_KEY_DOWN){ ofVec2f nudgeAmount = ofGetModifierKeyShift() ? getBigNudgePercent() : getNudgePercent(); if(args.key == OF_KEY_UP){ nudgeAmount.x = 0; } if(args.key == OF_KEY_DOWN){ nudgeAmount.x = 0; nudgeAmount.y = -nudgeAmount.y; } if(args.key == OF_KEY_RIGHT){ nudgeAmount.y = 0; } if(args.key == OF_KEY_LEFT){ nudgeAmount.x = -nudgeAmount.x; nudgeAmount.y = 0; } currentPage->nudgeBy(nudgeAmount); } ticker->keyPressed(args); currentPage->keyPressed(args); zoomer->keyPressed(args); } }
void ofxTLCameraTrack::mousePressed(ofMouseEventArgs& args) { if(bounds.inside(args.x, args.y)) { int selectedTrack = trackIndexForScreenX(args.x); if(selectedTrack == -1) { timeline->unselectAll(); return; } bool alreadySelected = isPointSelected(selectedTrack); if(!alreadySelected) { if(!ofGetModifierKeyShift()) { timeline->unselectAll(); } selectedTrackPoints.push_back( selectedTrack ); } mostRecentlySelected = selectedTrack; easeInSelected = args.x < screenXForIndex(track.getSamples()[selectedTrack].frame); canDrag = !ofGetModifierKeyShift(); updateDragOffsets(args.x); } }