private void RegionAdjustResizeOut_Invoked(object sender, EventArgs e) { var time = FormTimeEntry.GetUserTime("Region adjust", "Lengthen by"); if (time == null) { return; } RegionsResize(time); }
private void RegionAdjustSpacingIn_Invoked(object sender, EventArgs e) { var time = FormTimeEntry.GetUserTime("Region adjust", "Move closer by"); if (time == null) { return; } RegionsNudge(time, true); }
private void RegionAdjustAutoSize_Invoked(object sender, EventArgs e) { var time = FormTimeEntry.GetUserTime("Region adjust", "Enter headroom", "Headroom"); if (time == null) { return; } RegionsAutoSize(time); }
private void RegionAdjustNudgeRight_Invoked(object sender, EventArgs e) { var time = FormTimeEntry.GetUserTime("Region adjust", "Nudge right by"); if (time == null) { return; } RegionsNudge(time, false); }
private void SetMarkerOffset() { using (var undo = new UndoBlock("Set Marker Offset")) { Timecode ofs = FormTimeEntry.GetUserTime(); foreach (TrackEvent ev in myVegas.Project.GetSelectedEvents()) { SetCurrentMarkerOffset(ev, ofs); } } }
private void RegionAdjustResizeIn_Invoked(object sender, EventArgs e) { var time = FormTimeEntry.GetUserTime("Region adjust", "Shorten by"); if (time == null) { return; } time = Timecode.FromSeconds(0) - time; RegionsResize(time); }
private void RegionAdjustNudgeLeft_Invoked(object sender, EventArgs e) { var time = FormTimeEntry.GetUserTime("Region adjust", "Nudge left by"); if (time == null) { return; } time = Timecode.FromSeconds(0) - time; RegionsNudge(time, false); }
private void MarkerSetIntervalCommand_Invoked(object sender, EventArgs e) { if (myVegas.Project.Markers.Count <= 0) { return; } var selectedMks = myVegas.GetSelectedMarkers(); if (selectedMks.Count == 0 && myVegas.Project.Markers.Count != 0) { MessageBox.Show("Select a range of markers using the loop selection."); return; } Timecode time = FormTimeEntry.GetUserTime(); if (time == null) { MessageBox.Show("You must enter a valid time."); return; } Timecode inc = null; using (var undo = new UndoBlock("Set marker interval")) { foreach (Marker mk in selectedMks) { if (inc == null) { inc = mk.Position; } mk.Position = inc; inc += time; } } }
private void EventEdgeChange(EventEdgeAdjustMethod Method) { var userAmount = FormTimeEntry.GetUserTime(String.Format("Adjust {0} edge by", Method.ToString())); if (userAmount == null || userAmount.Nanos == 0) { return; } using (var undo = new UndoBlock("Adjust Event Edge")) { var events = myVegas.Project.GetSelectedEvents(); switch (Method) { case EventEdgeAdjustMethod.Left: foreach (var ev in events.Where(e => e.End + userAmount >= e.Start && e.Start - userAmount <= e.End)) // don't 'wrap' events { ev.End -= userAmount; foreach (Take take in ev.Takes) { take.Offset += userAmount; } ev.Start += userAmount; } break; case EventEdgeAdjustMethod.Right: foreach (var ev in events.Where(e => e.End + userAmount >= e.Start && e.Start - userAmount <= e.End)) { ev.End += userAmount; } break; } } }
/// Spacing manipulation /// private void EventPosSpaceChange(EventPositionModifyMethod Method) { List <TrackEvent> TargetEvents = myVegas.Project.GetSelectedEvents(true); if (TargetEvents.Count <= 1) { TargetEvents = GetEventsByTimeSelection(); if (TargetEvents.Count <= 1) { return; } } TrackEvent FirstEvent = TargetEvents[0]; TrackEvent LastEvent = TargetEvents[TargetEvents.Count - 1]; // Auto if (Method == EventPositionModifyMethod.Auto) { int _NumEvents = TargetEvents.Count; var MediaLength = new Timecode(); MediaLength = TargetEvents.Aggregate(MediaLength, (current, CurrentEvent) => current + CurrentEvent.Length); Timecode TotalTime = LastEvent.End - FirstEvent.Start; Timecode Space = TotalTime - MediaLength; Timecode MediumInterval = Timecode.FromNanos((Space.Nanos / (_NumEvents - 1))); using (var undo = new UndoBlock("Spacing: auto")) { TrackEvent prevEvent = null; for (int eventCounter = 1; eventCounter < TargetEvents.Count; eventCounter++) { TrackEvent curEvent = TargetEvents[eventCounter]; if (curEvent != null) { if (prevEvent != null) { curEvent.Start = prevEvent.End + MediumInterval; } } prevEvent = curEvent; } } return; } // User if (Method == EventPositionModifyMethod.User) { Timecode userInterval = FormTimeEntry.GetUserTime(); if (userInterval == null) { return; } using (var undo = new UndoBlock("Spacing: user")) { TrackEvent prevEvent = null; for (int eventCounter = 0; eventCounter < TargetEvents.Count; eventCounter++) { TrackEvent curEvent = TargetEvents[eventCounter]; if (curEvent != null) { if (prevEvent != null) { curEvent.Start = prevEvent.End + userInterval; } } prevEvent = curEvent; } } } }
/// Position manipulation /// private void EventPosInterChange(EventPositionModifyMethod Method, Timecode Interval) { List <TrackEvent> selectedEvents = myVegas.Project.GetSelectedEvents(true); if (selectedEvents.Count <= 1) { selectedEvents = GetEventsByTimeSelection(); if (selectedEvents.Count <= 1) { return; } } TrackEvent FirstEvent = selectedEvents[0]; TrackEvent LastEvent = selectedEvents[selectedEvents.Count - 1]; if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { Interval = (Timecode.FromNanos(Interval.Nanos * 10)); } // Adjust if ((Method == EventPositionModifyMethod.Adjust)) { using (var undo = new UndoBlock("Position: adjust")) { for (int EventCounter = 1; EventCounter < selectedEvents.Count; EventCounter++) { TrackEvent CurEvent = selectedEvents[EventCounter]; if (CurEvent != null) { CurEvent.Start = CurEvent.Start + Timecode.FromNanos(Interval.Nanos * EventCounter); } } } return; } // Auto if (Method == EventPositionModifyMethod.Auto) { // get some stats. Timecode MediumInterval = Timecode.FromNanos((LastEvent.Start.Nanos - FirstEvent.Start.Nanos) / (selectedEvents.Count - 1)); using (var undo = new UndoBlock("Position: auto")) { for (int EventCounter = 1; EventCounter < selectedEvents.Count - 1; EventCounter++) { TrackEvent CurEvent = selectedEvents[EventCounter]; if (CurEvent != null) { CurEvent.Start = FirstEvent.Start + Timecode.FromNanos(MediumInterval.Nanos * EventCounter); } } } return; } // User if (Method == EventPositionModifyMethod.User) { Timecode UserInterval = FormTimeEntry.GetUserTime(); if (UserInterval == null) { return; } using (var undo = new UndoBlock("Position: adjust")) { for (int EventCounter = 1; EventCounter < selectedEvents.Count; EventCounter++) { TrackEvent CurEvent = selectedEvents[EventCounter]; if (CurEvent != null) { CurEvent.Start = FirstEvent.Start + Timecode.FromNanos(UserInterval.Nanos * EventCounter); } } } } }