Example #1
0
        private void StartNewTasMovie()
        {
            if (AskSaveChanges())
            {
                Global.MovieSession.Movie = new TasMovie(false, _seekBackgroundWorker);
                var stateManager = ((TasMovie)Global.MovieSession.Movie).TasStateManager;

                stateManager.MountWriteAccess();
                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.
                HandleMovieLoadStuff();
                CurrentTasMovie.TasStateManager.Capture();      // Capture frame 0 always.

                // clear all selections
                TasView.DeselectAll();
                BookMarkControl.Restart();
                MarkerControl.Restart();
                SetUpColumns();
                RefreshDialog();
            }
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
		public void RefreshDialog()
		{
			TasView.BlazingFast = true;
			TasView.ItemCount = _tas.InputLogLength + 1;
			TasView.BlazingFast = false;
			if (MarkerControl != null)
			{
				MarkerControl.Refresh();
			}
		}
Example #5
0
        private void RemoveMarkersMenuItem_Click(object sender, EventArgs e)
        {
            IEnumerable <TasMovieMarker> markers = CurrentTasMovie.Markers.Where(m => TasView.SelectedRows.Contains(m.Frame));

            foreach (TasMovieMarker m in markers.ToList())
            {
                CurrentTasMovie.Markers.Remove(m);
            }
            MarkerControl.ShrinkSelection();
            RefreshDialog();
        }
Example #6
0
        // Slow but guarantees the entire dialog refreshes
        private void FullRefresh()
        {
            SetTasViewRowCount();
            TasView.Refresh();             // An extra refresh potentially but we need to guarantee
            MarkerControl.UpdateValues();
            BookMarkControl.UpdateValues();

            if (_undoForm != null && !_undoForm.IsDisposed)
            {
                _undoForm.UpdateValues();
            }
        }
Example #7
0
        public void RefreshDialog()
        {
            RefreshTasView();

            if (MarkerControl != null)
            {
                MarkerControl.UpdateValues();
            }

            if (undoForm != null && !undoForm.IsDisposed)
            {
                undoForm.UpdateValues();
            }
        }
Example #8
0
 private void SetMarkersMenuItem_Click(object sender, EventArgs e)
 {
     if (TasView.SelectedRows.Count() > 50)
     {
         var result = MessageBox.Show("Are you sure you want to add more than 50 markers?", "Add markers", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (result != DialogResult.OK)
         {
             return;
         }
     }
     foreach (var index in TasView.SelectedRows)
     {
         MarkerControl.AddMarker(false, index);
     }
 }
Example #9
0
        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);
        }
Example #10
0
        public void CallEditMarkerPopUp(TasMovieMarker marker)
        {
            var         markerFrame = marker.Frame;
            InputPrompt i           = new InputPrompt
            {
                Text          = "Marker for frame " + markerFrame,
                TextInputType = InputPrompt.InputType.Text,
                Message       = "Enter a message",
                InitialValue  = CurrentTasMovie.Markers.IsMarker(markerFrame) ? CurrentTasMovie.Markers.PreviousOrCurrent(markerFrame).Message : ""
            };

            var result = i.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                marker.Message = i.PromptText;
                MarkerControl.UpdateValues();
            }
        }
Example #11
0
        public void CallAddMarkerPopUp(int?frame = null)
        {
            var         markerFrame = frame ?? TasView.LastSelectedIndex ?? Emulator.Frame;
            InputPrompt i           = new InputPrompt
            {
                Text          = "Marker for frame " + markerFrame,
                TextInputType = InputPrompt.InputType.Text,
                Message       = "Enter a message",
                InitialValue  = CurrentTasMovie.Markers.IsMarker(markerFrame) ? CurrentTasMovie.Markers.PreviousOrCurrent(markerFrame).Message : ""
            };

            var result = i.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                CurrentTasMovie.Markers.Add(new TasMovieMarker(markerFrame, i.PromptText));
                MarkerControl.UpdateValues();
            }
        }
Example #12
0
		public void CallAddMarkerPopUp(int? frame = null)
		{
			var markerFrame = frame ?? TasView.LastSelectedIndex ?? Global.Emulator.Frame;
			InputPrompt i = new InputPrompt
			{
				Text = "Marker for frame " + markerFrame,
				TextInputType = InputPrompt.InputType.Text,
				Message = "Enter a message"
			};

			var result = i.ShowHawkDialog();

			if (result == DialogResult.OK)
			{
				_tas.Markers.Add(markerFrame, i.PromptText);
				MarkerControl.Refresh();
			}

			MarkerControl.Refresh();
		}
Example #13
0
        public void RefreshDialog(bool refreshTasView = true)
        {
            if (_exiting)
            {
                return;
            }

            if (refreshTasView)
            {
                RefreshTasView();
            }

            MarkerControl?.UpdateValues();

            BookMarkControl?.UpdateValues();

            if (_undoForm != null && !_undoForm.IsDisposed)
            {
                _undoForm.UpdateValues();
            }
        }
Example #14
0
        private bool StartNewMovieWrapper(ITasMovie movie)
        {
            _initializing = true;

            SetTasMovieCallbacks(movie);

            SuspendLayout();
            bool result = MainForm.StartNewMovie(movie, false);

            ResumeLayout();
            if (result)
            {
                BookMarkControl.UpdateTextColumnWidth();
                MarkerControl.UpdateTextColumnWidth();
                TastudioPlayMode();
            }

            _initializing = false;

            return(result);
        }
Example #15
0
        private void TasView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                var buttonName = TasView.CurrentCell.Column.Name;

                if (TasView.CurrentCell.RowIndex.HasValue &&
                    buttonName == FrameColumnName)
                {
                    if (Settings.EmptyMarkers)
                    {
                        CurrentTasMovie.Markers.Add(TasView.CurrentCell.RowIndex.Value, string.Empty);
                        RefreshDialog();
                    }
                    else
                    {
                        ClearLeftMouseStates();
                        MarkerControl.AddMarker(false, TasView.CurrentCell.RowIndex.Value);
                    }
                }
            }
        }
Example #16
0
        public void RefreshDialog(bool refreshTasView = true)
        {
            if (refreshTasView)
            {
                RefreshTasView();
            }

            if (MarkerControl != null)
            {
                MarkerControl.UpdateValues();
            }

            if (BookMarkControl != null)
            {
                BookMarkControl.UpdateValues();
            }

            if (_undoForm != null && !_undoForm.IsDisposed)
            {
                _undoForm.UpdateValues();
            }
        }
Example #17
0
        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();
        }
Example #18
0
        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();
        }
Example #19
0
        private bool StartNewMovieWrapper(ITasMovie movie)
        {
            _initializing = true;

            SetTasMovieCallbacks(movie);

            SuspendLayout();
            bool result = MainForm.StartNewMovie(movie, false);

            ResumeLayout();
            if (result)
            {
                CurrentTasMovie.TasStateManager.Capture();                 // Capture frame 0 always.
                BookMarkControl.UpdateTextColumnWidth();
                MarkerControl.UpdateTextColumnWidth();
            }

            TastudioPlayMode();

            _initializing = false;

            return(result);
        }
Example #20
0
        public void RefreshDialog(bool refreshTasView = true, bool refreshBranches = true)
        {
            if (_exiting)
            {
                return;
            }

            if (refreshTasView)
            {
                SetTasViewRowCount();
            }

            MarkerControl?.UpdateValues();

            if (refreshBranches)
            {
                BookMarkControl?.UpdateValues();
            }

            if (_undoForm != null && !_undoForm.IsDisposed)
            {
                _undoForm.UpdateValues();
            }
        }
Example #21
0
 private void SetMarkerWithTextMenuItem_Click(object sender, EventArgs e)
 {
     MarkerControl.AddMarker(true, TasView.SelectedRows.FirstOrDefault());
 }
Example #22
0
 private void ScrollToMarkerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SetVisibleIndex(MarkerControl.SelectedMarkerFrame());
     RefreshTasView();
 }
Example #23
0
 private void EditMarkerContextMenuItem_Click(object sender, EventArgs e)
 {
     MarkerControl.EditMarker();
 }
Example #24
0
 private void RemoveMarkerContextMenuItem_Click(object sender, EventArgs e)
 {
     MarkerControl.RemoveMarker();
 }