Ejemplo n.º 1
0
        private void BranchView_PointedCellChanged(object sender, InputRoll.CellEventArgs e)
        {
            if (e.NewCell?.RowIndex != null && e.NewCell.Column != null && e.NewCell.RowIndex < Movie.BranchCount)
            {
                if (BranchView.CurrentCell.Column.Name == BranchNumberColumnName &&
                    BranchView.CurrentCell.RowIndex.HasValue &&
                    BranchView.CurrentCell.RowIndex < Movie.BranchCount)
                {
                    TasBranch branch   = GetBranch(BranchView.CurrentCell.RowIndex.Value);
                    Point     location = Location;
                    int       width    = branch.OSDFrameBuffer.Width;
                    int       height   = branch.OSDFrameBuffer.Height;
                    location.Offset(-width, 0);

                    Screenshot.UpdateValues(branch, PointToScreen(location), width, height,
                                            (int)Graphics.FromHwnd(this.Handle).MeasureString(
                                                branch.UserText, Screenshot.Font, width).Height);

                    Screenshot.FadeIn();
                }
                else
                {
                    Screenshot.FadeOut();
                }
            }
            else
            {
                Screenshot.FadeOut();
            }
        }
Ejemplo n.º 2
0
 private void BranchView_CellDropped(object sender, InputRoll.CellEventArgs e)
 {
     if (e.NewCell != null && e.NewCell.IsDataCell && e.OldCell.RowIndex.Value < Movie.BranchCount)
     {
         Movie.SwapBranches(e.OldCell.RowIndex.Value, e.NewCell.RowIndex.Value);
     }
 }
Ejemplo n.º 3
0
        private void BranchView_CellHovered(object sender, InputRoll.CellEventArgs e)
        {
            if (e.NewCell != null && e.NewCell.RowIndex.HasValue && e.NewCell.Column != null && e.NewCell.RowIndex < Movie.BranchCount)
            {
                if (BranchView.CurrentCell.Column.Name == BranchNumberColumnName &&
                    BranchView.CurrentCell.RowIndex.HasValue &&
                    BranchView.CurrentCell.RowIndex < Movie.BranchCount)
                {
                    TasBranch branch = GetBranch(BranchView.CurrentCell.RowIndex.Value);
                    int       width  = Tastudio.VideoProvider.BufferWidth;
                    int       height = Tastudio.VideoProvider.BufferHeight;
                    Screenshot.UpdateValues(branch, width, height,
                                            (int)Graphics.FromHwnd(this.Handle).MeasureString(
                                                branch.UserText, Screenshot.Font, width).Height);

                    Point location = Location;
                    location.Offset(-Screenshot.Width, 0);
                    ScreenshotTooltip.Show(" ", this, location);
                }
                else
                {
                    ScreenshotTooltip.Hide(this);
                }
            }
            else
            {
                ScreenshotTooltip.Hide(this);
            }
        }
Ejemplo n.º 4
0
 private void BranchView_CellDropped(object sender, InputRoll.CellEventArgs e)
 {
     if (e.NewCell != null && e.NewCell.IsDataCell && e.OldCell.RowIndex.Value < Movie.BranchCount)
     {
         int currenthash = Movie.BranchHashByIndex(Movie.CurrentBranch);
         Movie.SwapBranches(e.OldCell.RowIndex.Value, e.NewCell.RowIndex.Value);
         int newindex = Movie.BranchIndexByHash(currenthash);
         Movie.CurrentBranch = newindex;
         BranchView.SelectRow(newindex, true);
     }
 }
Ejemplo n.º 5
0
 private void TasView_CellDropped(object sender, InputRoll.CellEventArgs e)
 {
     if (e.NewCell?.RowIndex != null && !CurrentTasMovie.Markers.IsMarker(e.NewCell.RowIndex.Value))
     {
         var currentMarker = CurrentTasMovie.Markers.Single(m => m.Frame == e.OldCell.RowIndex.Value);
         int newFrame      = e.NewCell.RowIndex.Value;
         var newMarker     = new TasMovieMarker(newFrame, currentMarker.Message);
         CurrentTasMovie.Markers.Remove(currentMarker);
         CurrentTasMovie.Markers.Add(newMarker);
         RefreshDialog();
     }
 }
Ejemplo n.º 6
0
 private void BranchView_CellHovered(object sender, InputRoll.CellEventArgs e)
 {
     if (e.NewCell != null && e.NewCell.RowIndex.HasValue && e.NewCell.Column != null && e.NewCell.RowIndex < Movie.BranchCount)
     {
         if (e.NewCell.Column.Name == BranchNumberColumnName)
         {
             ScreenShotPopUp(GetBranch(e.NewCell.RowIndex.Value), e.NewCell.RowIndex.Value);
         }
         else
         {
             CloseScreenShotPopUp();
         }
     }
     else
     {
         CloseScreenShotPopUp();
     }
 }
Ejemplo n.º 7
0
        private void TasView_PointedCellChanged(object sender, InputRoll.CellEventArgs e)
        {
            // TODO: think about nullability
            // For now return if a null because this happens OnEnter which doesn't have any of the below behaviors yet?
            // Most of these are stupid but I got annoyed at null crashes
            if (e.OldCell == null || e.OldCell.Column == null || e.OldCell.RowIndex == null ||
                e.NewCell == null || e.NewCell.RowIndex == null || e.NewCell.Column == null)
            {
                return;
            }

            int startVal, endVal;
            int frame = e.NewCell.RowIndex.Value;

            if (e.OldCell.RowIndex.Value < e.NewCell.RowIndex.Value)
            {
                startVal = e.OldCell.RowIndex.Value;
                endVal   = e.NewCell.RowIndex.Value;
            }
            else
            {
                startVal = e.NewCell.RowIndex.Value;
                endVal   = e.OldCell.RowIndex.Value;
            }

            if (_startMarkerDrag)
            {
                if (e.NewCell.RowIndex.HasValue)
                {
                    GoToFrame(e.NewCell.RowIndex.Value);
                }
            }
            else if (_startFrameDrag)
            {
                if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
                {
                    for (var i = startVal; i <= endVal; i++)
                    {
                        TasView.SelectRow(i, _frameDragState);
                    }

                    RefreshTasView();
                }
            }

            else if (_rightClickFrame != -1)
            {
                _triggerAutoRestore = true;
                _supressContextMenu = true;
                if (frame > CurrentTasMovie.InputLogLength - _rightClickInput.Length)
                {
                    frame = CurrentTasMovie.InputLogLength - _rightClickInput.Length;
                }
                if (_rightClickShift)
                {
                    if (_rightClickControl)                     // Insert
                    {
                        // If going backwards, delete!
                        bool shouldInsert = true;
                        if (startVal < _rightClickFrame)
                        {                         // Cloning to a previous frame makes no sense.
                            startVal = _rightClickFrame - 1;
                        }
                        if (startVal < _rightClickLastFrame)
                        {
                            shouldInsert = false;
                        }

                        if (shouldInsert)
                        {
                            for (int i = startVal + 1; i <= endVal; i++)
                            {
                                CurrentTasMovie.InsertInput(i, _rightClickInput[(i - _rightClickFrame) % _rightClickInput.Length]);
                            }
                        }
                        else
                        {
                            CurrentTasMovie.RemoveFrames(startVal + 1, endVal + 1);
                        }

                        _rightClickLastFrame = frame;
                    }
                    else                     // Overwrite
                    {
                        for (int i = startVal; i <= endVal; i++)
                        {
                            CurrentTasMovie.SetFrame(i, _rightClickInput[(_rightClickFrame - i) % _rightClickInput.Length]);
                        }
                        if (startVal < _triggerAutoRestoreFromFrame)
                        {
                            _triggerAutoRestoreFromFrame = startVal;
                        }
                    }
                }
                else
                {
                    if (_rightClickControl)
                    {
                        for (int i = 0; i < _rightClickInput.Length; i++)                         // Re-set initial range, just to verify it's still there.
                        {
                            CurrentTasMovie.SetFrame(_rightClickFrame + i, _rightClickInput[i]);
                        }

                        if (_rightClickOverInput != null)                         // Restore overwritten input from previous movement
                        {
                            for (int i = 0; i < _rightClickOverInput.Length; i++)
                            {
                                CurrentTasMovie.SetFrame(_rightClickLastFrame + i, _rightClickOverInput[i]);
                            }
                        }
                        else
                        {
                            _rightClickOverInput = new string[_rightClickInput.Length];
                        }

                        _rightClickLastFrame = frame;                         // Set new restore log
                        CurrentTasMovie.GetLogEntries().CopyTo(frame, _rightClickOverInput, 0, _rightClickOverInput.Length);

                        for (int i = 0; i < _rightClickInput.Length; i++)                         // Place copied input
                        {
                            CurrentTasMovie.SetFrame(frame + i, _rightClickInput[i]);
                        }
                    }
                    else
                    {
                        int      shiftBy    = _rightClickFrame - frame;
                        string[] shiftInput = new string[Math.Abs(shiftBy)];
                        int      shiftFrom  = frame;
                        if (shiftBy < 0)
                        {
                            shiftFrom = _rightClickFrame + _rightClickInput.Length;
                        }

                        CurrentTasMovie.GetLogEntries().CopyTo(shiftFrom, shiftInput, 0, shiftInput.Length);
                        int shiftTo = shiftFrom + (_rightClickInput.Length * Math.Sign(shiftBy));
                        for (int i = 0; i < shiftInput.Length; i++)
                        {
                            CurrentTasMovie.SetFrame(shiftTo + i, shiftInput[i]);
                        }

                        for (int i = 0; i < _rightClickInput.Length; i++)
                        {
                            CurrentTasMovie.SetFrame(frame + i, _rightClickInput[i]);
                        }
                        _rightClickFrame = frame;
                    }

                    if (frame < _triggerAutoRestoreFromFrame)
                    {
                        _triggerAutoRestoreFromFrame = frame;
                    }
                }
                RefreshTasView();
            }

            else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startBoolDrawColumn))
            {
                if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
                {
                    for (var i = startVal + 1; i <= endVal; i++)                     // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
                    {
                        bool setVal = _boolPaintState;
                        if (_patternPaint && _boolPaintState)
                        {
                            if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value)
                            {
                                setVal = CurrentTasMovie.BoolIsPressed(i - 1, _startBoolDrawColumn);
                            }
                            else
                            {
                                setVal = BoolPatterns[controllerType.BoolButtons.IndexOf(_startBoolDrawColumn)].GetNextValue();
                            }
                        }
                        CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, setVal);                         // Notice it uses new row, old column, you can only paint across a single column
                        if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame)
                        {
                            _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
                        }
                    }

                    RefreshTasView();
                }
            }

            else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startFloatDrawColumn))
            {
                if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
                {
                    for (var i = startVal + 1; i <= endVal; i++)                     // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
                    {
                        float setVal = _floatPaintState;
                        if (_patternPaint)
                        {
                            if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value)
                            {
                                setVal = CurrentTasMovie.GetFloatState(i - 1, _startFloatDrawColumn);
                            }
                            else
                            {
                                setVal = FloatPatterns[controllerType.FloatControls.IndexOf(_startFloatDrawColumn)].GetNextValue();
                            }
                        }
                        CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, setVal);                         // Notice it uses new row, old column, you can only paint across a single column
                        if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame)
                        {
                            _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
                        }
                    }

                    RefreshTasView();
                }
            }
        }
Ejemplo n.º 8
0
        private void TasView_PointedCellChanged(object sender, InputRoll.CellEventArgs e)
        {
            // TODO: think about nullability
            // For now return if a null because this happens OnEnter which doesn't have any of the below behaviors yet?
            // Most of these are stupid but I got annoyed at null crashes
            if (e.OldCell == null || e.OldCell.Column == null || e.OldCell.RowIndex == null ||
                e.NewCell == null || e.NewCell.RowIndex == null || e.NewCell.Column == null)
            {
                return;
            }

            // skip rerecord counting on drawing entirely, mouse down is enough
            // avoid introducing another global
            bool wasCountingRerecords = Global.MovieSession.Movie.IsCountingRerecords;

            int startVal, endVal;
            int frame = e.NewCell.RowIndex.Value;

            if (e.OldCell.RowIndex.Value < e.NewCell.RowIndex.Value)
            {
                startVal = e.OldCell.RowIndex.Value;
                endVal   = e.NewCell.RowIndex.Value;
            }
            else
            {
                startVal = e.NewCell.RowIndex.Value;
                endVal   = e.OldCell.RowIndex.Value;
            }

            if (_startCursorDrag)
            {
                if (e.NewCell.RowIndex.HasValue)
                {
                    GoToFrame(e.NewCell.RowIndex.Value);
                }
            }
            else if (_startSelectionDrag)
            {
                if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
                {
                    for (var i = startVal; i <= endVal; i++)
                    {
                        TasView.SelectRow(i, _selectionDragState);
                    }
                }
            }

            else if (_rightClickFrame != -1)
            {
                if (frame > CurrentTasMovie.InputLogLength - _rightClickInput.Length)
                {
                    frame = CurrentTasMovie.InputLogLength - _rightClickInput.Length;
                }
                if (_rightClickShift)
                {
                    if (_rightClickControl)                     // Insert
                    {
                        // If going backwards, delete!
                        bool shouldInsert = true;
                        if (startVal < _rightClickFrame)
                        {                         // Cloning to a previous frame makes no sense.
                            startVal = _rightClickFrame - 1;
                        }
                        if (startVal < _rightClickLastFrame)
                        {
                            shouldInsert = false;
                        }

                        if (shouldInsert)
                        {
                            for (int i = startVal + 1; i <= endVal; i++)
                            {
                                CurrentTasMovie.InsertInput(i, _rightClickInput[(i - _rightClickFrame).Mod(_rightClickInput.Length)]);
                            }
                        }
                        else
                        {
                            CurrentTasMovie.RemoveFrames(startVal + 1, endVal + 1);
                        }

                        _rightClickLastFrame = frame;
                    }
                    else                     // Overwrite
                    {
                        for (int i = startVal; i <= endVal; i++)
                        {
                            CurrentTasMovie.SetFrame(i, _rightClickInput[(i - _rightClickFrame).Mod(_rightClickInput.Length)]);
                        }
                    }
                }
                else
                {
                    if (_rightClickControl)
                    {
                        for (int i = 0; i < _rightClickInput.Length; i++)                         // Re-set initial range, just to verify it's still there.
                        {
                            CurrentTasMovie.SetFrame(_rightClickFrame + i, _rightClickInput[i]);
                        }

                        if (_rightClickOverInput != null)                         // Restore overwritten input from previous movement
                        {
                            for (int i = 0; i < _rightClickOverInput.Length; i++)
                            {
                                CurrentTasMovie.SetFrame(_rightClickLastFrame + i, _rightClickOverInput[i]);
                            }
                        }
                        else
                        {
                            _rightClickOverInput = new string[_rightClickInput.Length];
                        }

                        _rightClickLastFrame = frame;                         // Set new restore log
                        CurrentTasMovie.GetLogEntries().CopyTo(frame, _rightClickOverInput, 0, _rightClickOverInput.Length);

                        for (int i = 0; i < _rightClickInput.Length; i++)                         // Place copied input
                        {
                            CurrentTasMovie.SetFrame(frame + i, _rightClickInput[i]);
                        }
                    }
                    else if (_rightClickAlt)
                    {
                        int      shiftBy    = _rightClickFrame - frame;
                        string[] shiftInput = new string[Math.Abs(shiftBy)];
                        int      shiftFrom  = frame;
                        if (shiftBy < 0)
                        {
                            shiftFrom = _rightClickFrame + _rightClickInput.Length;
                        }

                        CurrentTasMovie.GetLogEntries().CopyTo(shiftFrom, shiftInput, 0, shiftInput.Length);
                        int shiftTo = shiftFrom + (_rightClickInput.Length * Math.Sign(shiftBy));
                        for (int i = 0; i < shiftInput.Length; i++)
                        {
                            CurrentTasMovie.SetFrame(shiftTo + i, shiftInput[i]);
                        }

                        for (int i = 0; i < _rightClickInput.Length; i++)
                        {
                            CurrentTasMovie.SetFrame(frame + i, _rightClickInput[i]);
                        }
                        _rightClickFrame = frame;
                    }
                }
                if (_rightClickAlt || _rightClickControl || _rightClickShift)
                {
                    JumpToGreenzone();
                    _triggerAutoRestore = true;
                    _supressContextMenu = true;
                }
            }
            // Left-click
            else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startBoolDrawColumn))
            {
                Global.MovieSession.Movie.IsCountingRerecords = false;

                if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
                {
                    for (int i = startVal; i <= endVal; i++)                     // Inclusive on both ends (drawing up or down)
                    {
                        bool setVal = _boolPaintState;
                        if (_patternPaint && _boolPaintState)
                        {
                            if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value)
                            {
                                setVal = CurrentTasMovie.BoolIsPressed(i - 1, _startBoolDrawColumn);
                            }
                            else
                            {
                                setVal = BoolPatterns[controllerType.BoolButtons.IndexOf(_startBoolDrawColumn)].GetNextValue();
                            }
                        }
                        CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, setVal);                         // Notice it uses new row, old column, you can only paint across a single column
                        JumpToGreenzone();
                    }
                }
            }

            else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startFloatDrawColumn))
            {
                Global.MovieSession.Movie.IsCountingRerecords = false;

                if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
                {
                    for (int i = startVal; i <= endVal; i++)                     // Inclusive on both ends (drawing up or down)
                    {
                        float setVal = _floatPaintState;
                        if (_patternPaint)
                        {
                            if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value)
                            {
                                setVal = CurrentTasMovie.GetFloatState(i - 1, _startFloatDrawColumn);
                            }
                            else
                            {
                                setVal = FloatPatterns[controllerType.FloatControls.IndexOf(_startFloatDrawColumn)].GetNextValue();
                            }
                        }
                        CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, setVal);                         // Notice it uses new row, old column, you can only paint across a single column
                        JumpToGreenzone();
                    }
                }
            }

            Global.MovieSession.Movie.IsCountingRerecords = wasCountingRerecords;

            if (mouseButtonHeld)
            {
                TasView.MakeIndexVisible(TasView.CurrentCell.RowIndex.Value);                 // todo: limit scrolling speed
            }
            RefreshTasView();
        }