private void StartNewTasMovie() { if (AskSaveChanges()) { Global.MovieSession.Movie = new TasMovie(); CurrentTasMovie.BindMarkersToInput = Settings.BindMarkersToInput; var stateManager = ((TasMovie)Global.MovieSession.Movie).TasStateManager; stateManager.InvalidateCallback = GreenzoneInvalidated; BookMarkControl.LoadedCallback = BranchLoaded; BookMarkControl.SavedCallback = BranchSaved; BookMarkControl.RemovedCallback = BranchRemoved; CurrentTasMovie.PropertyChanged += TasMovie_OnPropertyChanged; CurrentTasMovie.Filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename CurrentTasMovie.PopulateWithDefaultHeaderValues(); SetTasMovieCallbacks(); CurrentTasMovie.ClearChanges(); // Don't ask to save changes here. if (HandleMovieLoadStuff()) { CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always. } // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); SetUpColumns(); RefreshDialog(); } }
private void CutMenuItem_Click(object sender, EventArgs e) { if (TasView.SelectedIndices().Any()) { var needsToRollback = !(FirstSelectedIndex > Global.Emulator.Frame); var rollBackFrame = FirstSelectedIndex; _tasClipboard.Clear(); var list = TasView.SelectedIndices().ToArray(); var sb = new StringBuilder(); for (var i = 0; i < list.Length; i++) { var input = _tas.GetInputState(i); _tasClipboard.Add(new TasClipboardEntry(list[i], input)); var lg = _tas.LogGeneratorInstance(); lg.SetSource(input); sb.AppendLine(lg.GenerateLogEntry()); } Clipboard.SetDataObject(sb.ToString()); _tas.RemoveFrames(list); SetSplicer(); TasView.DeselectAll(); if (needsToRollback) { GoToFrame(rollBackFrame); } else { RefreshDialog(); } } }
private bool LoadFile(FileInfo file, bool startsFromSavestate = false, int gotoFrame = 0) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return(false); } TasMovie newMovie = new TasMovie(startsFromSavestate: startsFromSavestate); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; newMovie.BindMarkersToInput = Settings.BindMarkersToInput; BookMarkControl.LoadedCallback = BranchLoaded; BookMarkControl.SavedCallback = BranchSaved; BookMarkControl.RemovedCallback = BranchRemoved; if (!HandleMovieLoadStuff(newMovie)) { return(false); } Settings.RecentTas.Add(newMovie.Filename); // only add if it did load if (startsFromSavestate) { GoToFrame(0); } else if (gotoFrame > 0) { GoToFrame(gotoFrame); } else { GoToFrame(CurrentTasMovie.Session.CurrentFrame); } // If we are loading an existing non-default movie, we will already have columns generated // Only set up columns if needed if (!TasView.AllColumns.Any()) { SetUpColumns(); } SetUpToolStripColumns(); CurrentTasMovie.PropertyChanged += TasMovie_OnPropertyChanged; CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch; BookMarkControl.UpdateTextColumnWidth(); MarkerControl.UpdateTextColumnWidth(); // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); RefreshDialog(); return(true); }
private void ReselectClipboardMenuItem_Click(object sender, EventArgs e) { TasView.DeselectAll(); foreach (var item in _tasClipboard) { TasView.SelectItem(item.Frame, true); } }
private bool LoadFile(FileInfo file, bool startsFromSavestate = false, int gotoFrame = 0) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return(false); } TasMovie newMovie = new TasMovie(startsFromSavestate, _seekBackgroundWorker); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; BookMarkControl.LoadedCallback = BranchLoaded; BookMarkControl.SavedCallback = BranchSaved; BookMarkControl.RemovedCallback = BranchRemoved; if (!HandleMovieLoadStuff(newMovie)) { return(false); } Settings.RecentTas.Add(newMovie.Filename); // only add if it did load if (startsFromSavestate) { GoToFrame(0); } else if (gotoFrame > 0) { GoToFrame(gotoFrame); } else { GoToFrame(CurrentTasMovie.Session.CurrentFrame); } if (TasView.AllColumns.Count == 0 || file.Extension != $".{TasMovie.Extension}") { SetUpColumns(); } else { SetUpToolStripColumns(); } CurrentTasMovie.PropertyChanged += TasMovie_OnPropertyChanged; CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch; BookMarkControl.UpdateTextColumnWidth(); // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); RefreshDialog(); return(true); }
private void ReselectClipboardMenuItem_Click(object sender, EventArgs e) { TasView.DeselectAll(); foreach (var item in _tasClipboard) { TasView.SelectRow(item.Frame, true); } SetSplicer(); RefreshTasView(); }
private bool LoadFile(FileInfo file, bool startsFromSavestate = false) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return(false); } TasMovie newMovie = new TasMovie(startsFromSavestate, _saveBackgroundWorker); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; if (!HandleMovieLoadStuff(newMovie)) { return(false); } Settings.RecentTas.Add(newMovie.Filename); // only add if it did load if (TasView.AllColumns.Count() == 0 || file.Extension != "." + TasMovie.Extension) { SetUpColumns(); } if (startsFromSavestate) { GoToFrame(0); } else { GoToFrame(CurrentTasMovie.Session.CurrentFrame); } CurrentTasMovie.PropertyChanged += new PropertyChangedEventHandler(this.TasMovie_OnPropertyChanged); CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch; // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); RefreshDialog(); return(true); }
private void CutMenuItem_Click(object sender, EventArgs e) { if (TasView.AnyRowsSelected) { var wasPaused = GlobalWin.MainForm.EmulatorPaused; var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame; var rollBackFrame = TasView.FirstSelectedIndex.Value; _tasClipboard.Clear(); var list = TasView.SelectedRows.ToArray(); var sb = new StringBuilder(); for (var i = 0; i < list.Length; i++) { var input = CurrentTasMovie.GetInputState(i); _tasClipboard.Add(new TasClipboardEntry(list[i], input)); var lg = CurrentTasMovie.LogGeneratorInstance(); lg.SetSource(input); sb.AppendLine(lg.GenerateLogEntry()); } Clipboard.SetDataObject(sb.ToString()); CurrentTasMovie.RemoveFrames(list); SetSplicer(); TasView.DeselectAll(); if (needsToRollback) { GoToLastEmulatedFrameIfNecessary(rollBackFrame); if (wasPaused) { DoAutoRestore(); } else { GlobalWin.MainForm.UnpauseEmulator(); } } else { RefreshDialog(); } } }
private void DeleteFramesMenuItem_Click(object sender, EventArgs e) { if (TasView.SelectedIndices().Any()) { var needsToRollback = !(FirstSelectedIndex > Global.Emulator.Frame); var rollBackFrame = FirstSelectedIndex; _tasClipboard.Clear(); _tas.RemoveFrames(TasView.SelectedIndices().ToArray()); SetSplicer(); TasView.DeselectAll(); if (needsToRollback) { GoToFrame(rollBackFrame); } else { RefreshDialog(); } } }
private void StartNewTasMovie() { if (!AskSaveChanges()) { return; } var filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename var tasMovie = (ITasMovie)MovieService.Get(filename); tasMovie.BindMarkersToInput = Settings.BindMarkersToInput; tasMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; tasMovie.PropertyChanged += TasMovie_OnPropertyChanged; tasMovie.PopulateWithDefaultHeaderValues( Emulator, Global.Game, Global.FirmwareManager, Config.DefaultAuthor); SetTasMovieCallbacks(tasMovie); tasMovie.ClearChanges(); // Don't ask to save changes here. tasMovie.Save(); if (HandleMovieLoadStuff(tasMovie)) { CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always. } // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); SetUpColumns(); RefreshDialog(); TasView.Refresh(); }
private void StartNewTasMovie() { if (!AskSaveChanges()) { return; } var filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename var tasMovie = (ITasMovie)MovieSession.Get(filename); tasMovie.BindMarkersToInput = Settings.BindMarkersToInput; tasMovie.GreenzoneInvalidated = GreenzoneInvalidated; tasMovie.PropertyChanged += TasMovie_OnPropertyChanged; tasMovie.PopulateWithDefaultHeaderValues( Emulator, ((MainForm)MainForm).GetSettingsAdapterForLoadedCoreUntyped(), //HACK Game, MainForm.FirmwareManager, Config.DefaultAuthor); SetTasMovieCallbacks(tasMovie); tasMovie.ClearChanges(); // Don't ask to save changes here. tasMovie.Save(); if (HandleMovieLoadStuff(tasMovie)) { } // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); SetUpColumns(); RefreshDialog(); TasView.Refresh(); }
private void StartNewTasMovie() { if (AskSaveChanges()) { Global.MovieSession.Movie = new TasMovie(false, _seekBackgroundWorker); var stateManager = (Global.MovieSession.Movie as TasMovie).TasStateManager; stateManager.MountWriteAccess(); stateManager.InvalidateCallback = GreenzoneInvalidated; CurrentTasMovie.PropertyChanged += new PropertyChangedEventHandler(this.TasMovie_OnPropertyChanged); CurrentTasMovie.Filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename CurrentTasMovie.PopulateWithDefaultHeaderValues(); SetTasMovieCallbacks(); CurrentTasMovie.ClearChanges(); // Don't ask to save changes here. HandleMovieLoadStuff(); CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always. // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); SetUpColumns(); RefreshDialog(); } }
private void TasView_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right && !TasView.IsPointingAtColumnHeader && !_supressContextMenu && TasView.SelectedRows.Any()) { if (Global.MovieSession.Movie.FrameCount < TasView.SelectedRows.Max()) { // trying to be smart here // if a loaded branch log is shorter than selection, keep selection until you attempt to call context menu // you might need it when you load again the branch where this frame exists TasView.DeselectAll(); RefreshTasView(); } else { RightClickMenu.Show(TasView, e.X, e.Y); } } else if (e.Button == MouseButtons.Left) { ClearLeftMouseStates(); } if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (_rightClickFrame != -1) { _rightClickInput = null; _rightClickOverInput = null; _rightClickFrame = -1; CurrentTasMovie.ChangeLog.EndBatch(); } } _supressContextMenu = false; DoTriggeredAutoRestoreIfNeeded(); }
private void DeselectMenuItem_Click(object sender, EventArgs e) { TasView.DeselectAll(); RefreshTasView(); }