Exemplo n.º 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();
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
		public void RefreshDialog()
		{
			TasView.BlazingFast = true;
			TasView.ItemCount = _tas.InputLogLength + 1;
			TasView.BlazingFast = false;
			if (MarkerControl != null)
			{
				MarkerControl.Refresh();
			}
		}
Exemplo n.º 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();
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 7
0
        public void RefreshDialog()
        {
            RefreshTasView();

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

            if (undoForm != null && !undoForm.IsDisposed)
            {
                undoForm.UpdateValues();
            }
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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();
		}
Exemplo n.º 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();
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
                    }
                }
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 21
0
 private void SetMarkerWithTextMenuItem_Click(object sender, EventArgs e)
 {
     MarkerControl.AddMarker(true, TasView.SelectedRows.FirstOrDefault());
 }
Exemplo n.º 22
0
 private void ScrollToMarkerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SetVisibleIndex(MarkerControl.SelectedMarkerFrame());
     RefreshTasView();
 }
Exemplo n.º 23
0
 private void EditMarkerContextMenuItem_Click(object sender, EventArgs e)
 {
     MarkerControl.EditMarker();
 }
Exemplo n.º 24
0
 private void RemoveMarkerContextMenuItem_Click(object sender, EventArgs e)
 {
     MarkerControl.RemoveMarker();
 }