public void OnNext(UCommand cmd, bool isUndo) { if (cmd is SeekPlayPosTickNotification) { StopPlayback(); int tick = ((SeekPlayPosTickNotification)cmd).playPosTick; DocManager.Inst.ExecuteCmd(new SetPlayPosTickNotification(tick)); } else if (cmd is VolumeChangeNotification) { var _cmd = cmd as VolumeChangeNotification; if (faders != null && faders.Count > _cmd.TrackNo) { faders[_cmd.TrackNo].Scale = DecibelToVolume(_cmd.Volume); } } else if (cmd is LoadProjectNotification) { StopPlayback(); DocManager.Inst.ExecuteCmd(new SetPlayPosTickNotification(0)); } if (!(cmd is UNotification) || cmd is LoadProjectNotification) { SchedulePreRender(); } }
public void ExecuteCmd(UCommand cmd, bool quiet = false) { if (cmd is UNotification) { if (cmd is SaveProjectNotification) { var _cmd = cmd as SaveProjectNotification; if (undoQueue.Count > 0) savedPoint = undoQueue.Last(); if (_cmd.Path == "") OpenUtau.Core.Formats.USTx.Save(Project.FilePath, Project); else OpenUtau.Core.Formats.USTx.Save(_cmd.Path, Project); } else if (cmd is LoadProjectNotification) { undoQueue.Clear(); redoQueue.Clear(); undoGroup = null; savedPoint = null; this._project = ((LoadProjectNotification)cmd).project; this.playPosTick = 0; } else if (cmd is SetPlayPosTickNotification) { var _cmd = cmd as SetPlayPosTickNotification; this.playPosTick = _cmd.playPosTick; } Publish(cmd); if (!quiet) System.Diagnostics.Debug.WriteLine("Publish notification " + cmd.ToString()); return; } else if (undoGroup == null) { System.Diagnostics.Debug.WriteLine("Null undoGroup"); return; } else { undoGroup.Commands.Add(cmd); cmd.Execute(); Publish(cmd); } if (!quiet) System.Diagnostics.Debug.WriteLine("ExecuteCmd " + cmd.ToString()); }
public void OnNext(UCommand cmd, bool isUndo) { if (cmd is ProgressBarNotification) Update((ProgressBarNotification)cmd); }
public void ExecuteCmd(UCommand cmd) { if (cmd is UNotification) { if (cmd is SaveProjectNotification) { var _cmd = cmd as SaveProjectNotification; if (undoQueue.Count > 0) { savedPoint = undoQueue.Last(); } if (string.IsNullOrEmpty(_cmd.Path)) { Formats.Ustx.Save(Project.FilePath, Project); } else { Formats.Ustx.Save(_cmd.Path, Project); } } else if (cmd is LoadProjectNotification notification) { undoQueue.Clear(); redoQueue.Clear(); undoGroup = null; savedPoint = null; Project = notification.project; playPosTick = 0; } else if (cmd is SetPlayPosTickNotification) { var _cmd = cmd as SetPlayPosTickNotification; playPosTick = _cmd.playPosTick; } else if (cmd is SingersChangedNotification) { SearchAllSingers(); } Publish(cmd); if (!cmd.Silent) { Log.Information($"Publish notification {cmd}"); } return; } if (undoGroup == null) { Log.Error($"No active UndoGroup {cmd}"); return; } undoGroup.Commands.Add(cmd); lock (Project) { cmd.Execute(); } if (!cmd.Silent) { Log.Information($"ExecuteCmd {cmd}"); } Publish(cmd); Project.Validate(); }
public void OnNext(UCommand cmd, bool isUndo) { if (cmd is SeekPlayPosTickNotification) { StopPlayback(); int tick = ((SeekPlayPosTickNotification)cmd).playPosTick; DocManager.Inst.ExecuteCmd(new SetPlayPosTickNotification(tick)); } else if (cmd is VolumeChangeNotification) { var _cmd = cmd as VolumeChangeNotification; if (trackSources != null && trackSources.Count > _cmd.TrackNo) { trackSources[_cmd.TrackNo].Volume = DecibelToVolume(_cmd.Volume); } } }
public void OnNext(UCommand cmd, bool isUndo) { if (cmd is RedrawNotesNotification) { } }
public void Publish(UCommand cmd, bool isUndo = false) { foreach (var sub in subscribers) sub.OnNext(cmd, isUndo); }
public void OnNext(UCommand cmd, bool isUndo) { if (cmd is PartCommand) { var _cmd = cmd as PartCommand; if (_cmd.part != _partContainer.Part) return; else if (_cmd is RemovePartCommand) _partContainer.Part = null; } else if (cmd is UNotification) { var _cmd = cmd as UNotification; if (_cmd is LoadPartNotification) { if (!(_cmd.part is UVoicePart)) return; _partContainer.Part = (UVoicePart)_cmd.part; _project = _cmd.project; } else if (_cmd is LoadProjectNotification) OnProjectLoad(_cmd); } }
public void OnNext(UCommand cmd, bool isUndo) { if (cmd is ChangeExpressionListNotification || cmd is LoadProjectNotification) OnListChange(); else if (cmd is LoadPartNotification) { if (_keys.Count == 0) OnListChange(); } else if (cmd is SelectExpressionNotification) OnSelectExp((SelectExpressionNotification)cmd); }