Exemple #1
0
        public void ProcessKey(KeyboardCommandData key)
        {
            var shiftValue = 200;

            if (key.Shift || key.Ctrl)
            {
                shiftValue = 50;
            }
            if (CommonKeyboardProcessing.ProcessCommonKeys(model, key))
            {
                return;
            }


            switch (key.Command)
            {
            case KeyboardCommands.LargeLeft:
                PrevChunk();
                return;

            case KeyboardCommands.LargeRight:
                NextChunk();
                return;


            case KeyboardCommands.LeftToLeft:
                ShiftLeft(-shiftValue);
                return;

            case KeyboardCommands.LeftToRight:
                ShiftLeft(shiftValue);
                return;

            case KeyboardCommands.RightToLeft:
                ShiftRight(-shiftValue);
                return;

            case KeyboardCommands.RightToRight:
                ShiftRight(shiftValue);
                return;

            case KeyboardCommands.SpeedUp:
                model.WindowState.SpeedRatio += 0.5;
                return;

            case KeyboardCommands.SpeedDown:
                model.WindowState.SpeedRatio -= 0.5;
                return;
            }
        }
Exemple #2
0
        public void ProcessKey(KeyboardCommandData key)
        {
            if (CommonKeyboardProcessing.NavigationKeysProcessing(model, key))
            {
                return;
            }



            var fix = GetCurrentFix();

            if (fix == null && key.Command == KeyboardCommands.Face)
            {
                int position = 0;
                for (; position < model.Montage.SubtitleFixes.Count; position++)
                {
                    if (model.Montage.SubtitleFixes[position].StartTime > model.WindowState.CurrentPosition)
                    {
                        break;
                    }
                }

                model.Montage.SubtitleFixes.Insert(position, new SubtitleFix {
                    StartTime = model.WindowState.CurrentPosition, Length = 2000
                });

                model.OnNonSignificantChanged();
                return;
            }


            if (fix == null)
            {
                return;
            }

            int delta = 200;

            if (key.Ctrl)
            {
                delta = 100;
            }
            if (key.Shift)
            {
                delta = 50;
            }


            switch (key.Command)
            {
            case KeyboardCommands.LeftToLeft:
                fix.StartTime -= delta;
                fix.Length    += delta;
                model.OnNonSignificantChanged();
                return;

            case KeyboardCommands.LeftToRight:
                fix.StartTime += delta;
                fix.Length    -= delta;
                model.OnNonSignificantChanged();
                return;

            case KeyboardCommands.RightToLeft:
                fix.Length -= delta;
                model.OnNonSignificantChanged();
                return;

            case KeyboardCommands.RightToRight:
                fix.Length += delta;
                model.OnNonSignificantChanged();
                return;

            case KeyboardCommands.Drop:
                model.Montage.SubtitleFixes.Remove(fix);
                model.OnNonSignificantChanged();
                return;

            case KeyboardCommands.Desktop:
                fix.Text = FixWindow.EnterText(fix.Text);
                return;
            }
        }
Exemple #3
0
        public void ProcessKey(KeyboardCommandData key)
        {
            if (CommonKeyboardProcessing.ProcessCommonKeys(model, key))
            {
                return;
            }


            switch (key.Command)
            {
            case KeyboardCommands.LargeRight:
                var border = montage.Borders.Where(z => z.StartTime > model.WindowState.CurrentPosition).FirstOrDefault();
                if (border != null)
                {
                    model.WindowState.CurrentPosition = border.StartTime;
                }
                return;

            case KeyboardCommands.LargeLeft:
                var border1 = montage.Borders.Where(z => z.EndTime < model.WindowState.CurrentPosition).LastOrDefault();
                if (border1 != null)
                {
                    model.WindowState.CurrentPosition = border1.StartTime;
                }
                return;

            case KeyboardCommands.SpeedDown:
                FastSpeed -= 0.5;
                return;

            case KeyboardCommands.SpeedUp:
                FastSpeed += 0.5;
                return;
            }



            var borderIndex = montage.Borders.FindBorder(model.WindowState.CurrentPosition);

            if (borderIndex == -1)
            {
                return;
            }
            int leftBorderIndex  = -1;
            int rightBorderIndex = -1;

            if (montage.Borders[borderIndex].IsLeftBorder)
            {
                leftBorderIndex = borderIndex;
                if (borderIndex != 0 && !montage.Borders[borderIndex - 1].IsLeftBorder)
                {
                    rightBorderIndex = borderIndex - 1;
                }
            }
            else
            {
                rightBorderIndex = borderIndex;
                if (borderIndex != montage.Borders.Count - 1 && montage.Borders[borderIndex + 1].IsLeftBorder)
                {
                    leftBorderIndex = borderIndex + 1;
                }
            }

            var value = 200;

            if (key.Shift)
            {
                value = 50;
            }


            switch (key.Command)
            {
            case KeyboardCommands.LeftToLeft:
                Shift(rightBorderIndex, -value);
                return;

            case KeyboardCommands.LeftToRight:
                Shift(rightBorderIndex, value);
                return;

            case KeyboardCommands.RightToLeft:
                Shift(leftBorderIndex, -value);
                return;

            case KeyboardCommands.RightToRight:
                Shift(leftBorderIndex, value);
                return;
            }
        }