private void deleteKeyframe(Keyframe key) { Keyframes keys = currentSlide.keys; var victimIndex = keys.IndexOf(key); if (currentKeyframeIndex == victimIndex) { if (currentKeyframeIndex == (keys.Count - 1)) { selectKeyframe(keys[currentKeyframeIndex - 1]); } else { selectKeyframe(keys[currentKeyframeIndex + 1]); } } KeyframeControl kfc = key.keyframeControl; keyframePanel.Children.Remove(kfc); keys.Remove(key); if (currentKeyframeIndex > victimIndex) { currentKeyframeIndex--; } }
private void cutKeyframe(Keyframe key) { Keyframes keys = currentSlide.keys; if (keys.Count == 1) { MessageBox.Show("At least one keyframe is required"); return; } kfDeletedHistory(key, keys.IndexOf(key)); deleteKeyframe(key); clipboardKey = key; }
public void selectKeyframe(Keyframe key) { Keyframes keys = currentSlide.keys; int keyFrameIndex = keys.IndexOf(key); if (currentKeyframeIndex >= 0) { Keyframe oldKey = keys[currentKeyframeIndex]; KeyframeControl oldKFControl = oldKey.keyframeControl; unBindKFC(oldKFControl, oldKey); oldKFControl.DeSelect(); } currentKeyframeIndex = keyFrameIndex; imageCropper.updateLayout(); imageCropper.cropZoom = key.zoomFactor; imageCropper.cropX = key.x; imageCropper.cropY = key.y; imageCropper.updateLayout(); KeyframeControl kfControl = key.keyframeControl; kfControl.Select(); Binding xBinding = new Binding("cropX") { Source = imageCropper, Mode = BindingMode.OneWay }; kfControl.xTb.SetBinding(TextBox.TextProperty, xBinding); Binding yBinding = new Binding("cropY") { Source = imageCropper, Mode = BindingMode.OneWay }; kfControl.yTb.SetBinding(TextBox.TextProperty, yBinding); Binding zoomBinding = new Binding("cropZoom") { Source = imageCropper, Mode = BindingMode.OneWay }; kfControl.zoomTb.SetBinding(TextBox.TextProperty, zoomBinding); }
private void insertKeyframeClick(object sender, RoutedEventArgs e, Keyframe key) { Keyframes keys = currentSlide.keys; var insertIndex = keys.IndexOf(key); Keyframe newKey = key.Clone(DEFAULT_DURATION); keys.Insert(insertIndex, newKey); addKeyframeControl(newKey, insertIndex); if (currentKeyframeIndex >= insertIndex) { currentKeyframeIndex++; } selectKeyframe(newKey); kfAddedHistory(insertIndex); }