Пример #1
0
        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();
            }
        }
Пример #2
0
        private bool HandleMovieLoadStuff(TasMovie movie = null)
        {
            bool result;

            WantsToControlStopMovie = false;

            if (movie == null)
            {
                movie  = CurrentTasMovie;
                result = StartNewMovieWrapper(movie.InputLogLength == 0, movie);
            }
            else
            {
                result = StartNewMovieWrapper(false, movie);
            }

            if (!result)
            {
                return(false);
            }

            WantsToControlStopMovie = true;

            CurrentTasMovie.ChangeLog.ClearLog();
            CurrentTasMovie.ClearChanges();

            SetTextProperty();
            MessageStatusLabel.Text = $"{Path.GetFileName(CurrentTasMovie.Filename)} loaded.";

            return(true);
        }
Пример #3
0
        /// <summary>
        /// Ask whether changes should be saved. Returns false if cancelled, else true.
        /// </summary>
        public override bool AskSaveChanges()
        {
            if (_suppressAskSave)
            {
                return(true);
            }

            StopSeeking();

            if (CurrentTasMovie != null && CurrentTasMovie.Changes)
            {
                var result = MainForm.DoWithTempMute(() => MessageBox.Show(
                                                         "Save Changes?",
                                                         "Tastudio",
                                                         MessageBoxButtons.YesNoCancel,
                                                         MessageBoxIcon.Question,
                                                         MessageBoxDefaultButton.Button3));
                if (result == DialogResult.Yes)
                {
                    SaveTas();
                }
                else if (result == DialogResult.No)
                {
                    CurrentTasMovie.ClearChanges();
                    return(true);
                }
                else if (result == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #4
0
        private bool HandleMovieLoadStuff(TasMovie movie = null)
        {
            bool result;

            WantsToControlStopMovie = false;

            if (movie == null)
            {
                movie  = CurrentTasMovie;
                result = StartNewMovieWrapper(movie.InputLogLength == 0, movie);
            }
            else
            {
                if (movie.Filename.EndsWith(TasMovie.Extension))
                {
                }
                else if (movie.Filename.EndsWith(".bkm") || movie.Filename.EndsWith(".bk2"))                 // was loaded using "All Files" filter. todo: proper extention iteration
                {
                    var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it, in order to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (result1 == DialogResult.OK)
                    {
                        ConvertCurrentMovieToTasproj();
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                result = StartNewMovieWrapper(false, movie);
            }

            if (!result)
            {
                return(false);
            }

            WantsToControlStopMovie = true;

            CurrentTasMovie.ChangeLog.ClearLog();
            CurrentTasMovie.ClearChanges();

            SetTextProperty();
            MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " loaded.";

            return(true);
        }
Пример #5
0
        private bool HandleMovieLoadStuff(ITasMovie movie)
        {
            WantsToControlStopMovie = false;
            var result = StartNewMovieWrapper(movie);

            if (!result)
            {
                return(false);
            }

            WantsToControlStopMovie = true;

            CurrentTasMovie.ChangeLog.Clear();
            CurrentTasMovie.ClearChanges();

            SetTextProperty();
            MessageStatusLabel.Text = $"{Path.GetFileName(CurrentTasMovie.Filename)} loaded.";

            return(true);
        }
Пример #6
0
        public override bool AskSaveChanges()
        {
            if (_suppressAskSave)
            {
                return(true);
            }

            StopSeeking();

            if (CurrentTasMovie != null && CurrentTasMovie.Changes)
            {
                GlobalWin.Sound.StopSound();
                var result = MessageBox.Show(
                    "Save Changes?",
                    "Tastudio",
                    MessageBoxButtons.YesNoCancel,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button3);

                GlobalWin.Sound.StartSound();
                if (result == DialogResult.Yes)
                {
                    _exiting = true;                     // Asking to save changes should only ever be called when closing something
                    SaveTas();
                }
                else if (result == DialogResult.No)
                {
                    CurrentTasMovie.ClearChanges();
                    return(true);
                }
                else if (result == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #7
0
 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();
     }
 }