using QuikDawEditor.EditingClasses; using System.Collections.Generic; using static QuikDawEditor.EDITING.MiscMethods; namespace QuikDawEditor.Undo; public class GainPointAddedUndo : UndoClass { public string UndoMainValue { get { return "Delete gain point at idx: " + GainPointIdx; } } string UndoClipID; int GainPointIdx; public GainPointAddedUndo(string undoClipID, int gainPointIdx) { UndoClipID = undoClipID; GainPointIdx = gainPointIdx; } public override void Undo() { Clip undoClip = GetClipFromID(UndoClipID); undoClip.GainPoints.RemoveAt(GainPointIdx); undoClip.NotifyGainPointsChanged(); } } public class GainPointDeletedUndoClass : UndoClass { public string UndoMainValue { get { return "Add gainpoint idx: " + DeletedIndex.ToString(); } } int DeletedIndex = -1; string UndoClipID; GainPoint RestoreGP; public GainPointDeletedUndoClass(string undoClipID, int gainpointIdx, GainPoint restoreGP) { UndoClipID = undoClipID; DeletedIndex = gainpointIdx; RestoreGP = restoreGP; } public override void Undo() { Clip thisClip = GetClipFromID(UndoClipID); thisClip.GainPoints.Insert(DeletedIndex, RestoreGP); thisClip.NotifyGainPointsChanged(); } } public class GainPointMovedUndoClass : UndoClass { public string UndoMainValue { get { return "Move gain point back: " + GainPointMs.ToString() + "::" + GainPointVal.ToString(); } } string UndoClipID; int GainPointIdx = -1; double GainPointMs = 0; float GainPointVal = 0; public GainPointMovedUndoClass(string undoClipID, int gainPointIdx, double gainPointMs, float gainPointVal) {UndoClipID = undoClipID; GainPointIdx = gainPointIdx; GainPointMs = gainPointMs; GainPointVal = gainPointVal; } public override void Undo() { Clip undoClip = GetClipFromID(UndoClipID); undoClip.GainPoints[GainPointIdx].sourcePointms = GainPointMs; undoClip.GainPoints[GainPointIdx].GainValue = GainPointVal; undoClip.NotifyGainPointsChanged(); } } public class GainPointsClearedUndoClass : UndoClass { public string UndoMainValue { get { return "Restore cleared gain pts: " + RestoreGainPoints.Count.ToString(); } } string UndoClipID; List RestoreGainPoints; float ClipStartAPVal, ClipEndAPVal; public GainPointsClearedUndoClass(string undoClipID, List restoreGainPoints, float clipStartAPVal, float clipEndAPVal) { UndoClipID = undoClipID; RestoreGainPoints = restoreGainPoints; ClipStartAPVal = clipStartAPVal; ClipEndAPVal = clipEndAPVal; } public override void Undo() { Clip undoClip = GetClipFromID(UndoClipID); undoClip.ClipStartGainPoint.GainValue = ClipStartAPVal; undoClip.ClipEndGainPoint.GainValue = ClipEndAPVal; foreach (GainPoint gp in RestoreGainPoints) undoClip.GainPoints.Insert(1, gp); undoClip.NotifyGainPointsChanged(); } } public class GainPointsFadeInUndoClass : UndoClass { public string UndoMainValue { get { return "Remove fadeIn at: " + insertedGainPointIndex.ToString(); } } string UndoClipID; int insertedGainPointIndex = -1; List RestoreGainPoints; float ClipStartGPVal; public GainPointsFadeInUndoClass(string undoClipID, int insertGPIdx, List restoreGainPoints, float clipStartGPVal) { UndoClipID = undoClipID; insertedGainPointIndex = insertGPIdx; RestoreGainPoints = restoreGainPoints; ClipStartGPVal = clipStartGPVal; } public override void Undo() { Clip undoClip = GetClipFromID(UndoClipID); undoClip.GainPoints.RemoveAt(insertedGainPointIndex); undoClip.ClipStartGainPoint.GainValue = ClipStartGPVal; for (int restoreno = RestoreGainPoints.Count - 1; restoreno > -1; restoreno--) undoClip.GainPoints.Insert(insertedGainPointIndex, RestoreGainPoints[restoreno]); undoClip.NotifyGainPointsChanged(); } } public class GainPointsFadeOutUndoClass : UndoClass { public string UndoMainValue { get { return "Remove fadeOut at: " + insertedGainPointIndex.ToString(); } } string UndoClipID; int insertedGainPointIndex = -1; List RestoreGainPoints; float ClipEndGPVal; public GainPointsFadeOutUndoClass(string undoClipID, int insertGPIdx, List restoreGainPoints, float clipEndGPVal) { UndoClipID = undoClipID; insertedGainPointIndex = insertGPIdx; RestoreGainPoints = restoreGainPoints; ClipEndGPVal = clipEndGPVal; } public override void Undo() { Clip undoClip = GetClipFromID(UndoClipID); undoClip.GainPoints.RemoveAt(insertedGainPointIndex); undoClip.ClipEndGainPoint.GainValue = ClipEndGPVal; for (int restoreno = RestoreGainPoints.Count - 1; restoreno > -1; restoreno--) undoClip.GainPoints.Insert(insertedGainPointIndex, RestoreGainPoints[restoreno]); undoClip.NotifyGainPointsChanged(); } } public class GainPointsSelectionClearedOrResetUndoClass : UndoClass { public string UndoMainValue { get { return "Restore cleared: " + RestoreGainPoints.Count.ToString(); } } string UndoClipID; int ResetPointsIdx = -1; List RestoreGainPoints; bool EndsAdded = false; public GainPointsSelectionClearedOrResetUndoClass(string undoClipID, int resetPtsIdx, List restoreGainPoints, bool endsadded) { UndoClipID = undoClipID; ResetPointsIdx = resetPtsIdx; RestoreGainPoints = restoreGainPoints; EndsAdded = endsadded; } public override void Undo() { Clip undoClip = GetClipFromID(UndoClipID); if (EndsAdded) { undoClip.GainPoints.RemoveAt(ResetPointsIdx); undoClip.GainPoints.RemoveAt(ResetPointsIdx); } for (int restoreno = RestoreGainPoints.Count - 1; restoreno > -1; restoreno--) undoClip.GainPoints.Insert(ResetPointsIdx, RestoreGainPoints[restoreno]); undoClip.NotifyGainPointsChanged(); } } public class GainPointsSelectionMutedUndoClass : UndoClass { public string UndoMainValue { get { return "Restore mute cleared: " + RestoreGainPoints.Count.ToString(); } } string UndoClipID; int ResetPointsIdx = -1; List RestoreGainPoints; public GainPointsSelectionMutedUndoClass(string undoClipID, int resetPtsIdx, List restoreGainPoints) { UndoClipID = undoClipID; ResetPointsIdx = resetPtsIdx; RestoreGainPoints = restoreGainPoints; } public override void Undo() { Clip undoClip = GetClipFromID(UndoClipID); for (int i = 0; i < 4; i++) undoClip.GainPoints.RemoveAt(ResetPointsIdx); for (int restoreno = RestoreGainPoints.Count - 1; restoreno > -1; restoreno--) undoClip.GainPoints.Insert(ResetPointsIdx, RestoreGainPoints[restoreno]); undoClip.NotifyGainPointsChanged(); } }