public static bool ProcessNavigationKey(this IEditorMode mode, KeyboardCommandData key) { var model = mode.Model; var delta = 1000; if (key.Shift) { delta = 200; } if (key.Ctrl) { delta = 50; } switch (key.Command) { case KeyboardCommands.Left: model.WindowState.CurrentPosition = ((int)(model.WindowState.CurrentPosition - delta)); return(true); case KeyboardCommands.Right: model.WindowState.CurrentPosition = ((int)(model.WindowState.CurrentPosition + delta)); return(true); case KeyboardCommands.PauseResume: model.WindowState.Paused = !model.WindowState.Paused; return(true); } return(false); }
public static bool ProcessCommonKeys(EditorModel model, KeyboardCommandData key) { if (NavigationKeysProcessing(model, key)) { return(true); } switch (key.Command) { case KeyboardCommands.Face: model.MarkHere(Mode.Face, key.Ctrl); return(true); case KeyboardCommands.Desktop: model.MarkHere(Mode.Desktop, key.Ctrl); return(true); case KeyboardCommands.Drop: model.MarkHere(Mode.Drop, key.Ctrl); return(true); case KeyboardCommands.Clear: model.RemoveChunkHere(); return(true); case KeyboardCommands.NewEpisodeHere: model.NewEpisodeHere(); return(true); } return(false); }
public static bool NavigationKeysProcessing(EditorModel model, KeyboardCommandData key) { var delta = 1000; if (key.Shift) { delta = 200; } if (key.Ctrl) { delta = 50; } switch (key.Command) { case KeyboardCommands.Left: model.WindowState.CurrentPosition = ((int)(model.WindowState.CurrentPosition - delta)); return(true); case KeyboardCommands.Right: model.WindowState.CurrentPosition = ((int)(model.WindowState.CurrentPosition + delta)); return(true); case KeyboardCommands.PauseResume: model.WindowState.Paused = !model.WindowState.Paused; return(true); case KeyboardCommands.InsertDeletion: model.InsertDeletion(model.WindowState.CurrentPosition); return(true); } return(false); }
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; } }
public void ProcessKey(KeyboardCommandData key) { if (this.ProcessNavigationKey(key)) { return; } if (this.DefaultSpeedKey(key)) { return; } if (Model.WindowState.PatchSelection == null) { return; } var shiftValue = 200; var delta = 1000; if (key.Shift || key.Ctrl) { shiftValue = 50; } var selection = Model.WindowState.PatchSelection; switch (key.Command) { case KeyboardCommands.LeftToLeft: selection.Item.Begin = Math.Max(0, selection.Item.Begin - shiftValue); Model.OnMarkupChanged(); Model.WindowState.CurrentPosition = selection.Item.Begin - delta; break; case KeyboardCommands.RightToLeft: selection.Item.End = Math.Max(selection.Item.Begin, selection.Item.End - shiftValue); Model.OnMarkupChanged(); Model.WindowState.CurrentPosition = selection.Item.End - delta; break; case KeyboardCommands.LeftToRight: selection.Item.Begin = Math.Min(selection.Item.Begin + shiftValue, selection.Item.End); Model.OnMarkupChanged(); Model.WindowState.CurrentPosition = selection.Item.Begin - delta; break; case KeyboardCommands.RightToRight: selection.Item.End = selection.Item.End + shiftValue; Model.OnMarkupChanged(); Model.WindowState.CurrentPosition = selection.Item.End - delta; break; } }
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; } }
public static bool ProcessCommonMarkupKey(this IEditorMode mode, KeyboardCommandData key) { var model = mode.Model; switch (key.Command) { case KeyboardCommands.InsertDeletion: model.InsertDeletion(model.WindowState.CurrentPosition); return(true); case KeyboardCommands.NewEpisodeHere: model.NewEpisodeHere(); return(true); } return(false); }
public static bool DefaultSpeedKey(this IEditorMode mode, KeyboardCommandData key) { var Model = mode.Model; switch (key.Command) { case KeyboardCommands.SpeedUp: Model.WindowState.SpeedRatio += 0.5; Model.WindowState.SpeedRatio = Math.Min(3, Model.WindowState.SpeedRatio); return(true); case KeyboardCommands.SpeedDown: Model.WindowState.SpeedRatio -= 0.5; Model.WindowState.SpeedRatio = Math.Max(0.5, Model.WindowState.SpeedRatio); return(true); } return(false); }
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; } }
public static bool ProcessCommonKeys(EditorModel model, KeyboardCommandData key) { if (NavigationKeysProcessing(model, key)) return true; var delta = 1000; if (key.Shift) delta = 200; if (key.Ctrl) delta = 50; switch (key.Command) { case KeyboardCommands.Face: model.MarkHere(Mode.Face, key.Ctrl); return true; case KeyboardCommands.Desktop: model.MarkHere(Mode.Screen, key.Ctrl); return true; case KeyboardCommands.Drop: model.MarkHere(Mode.Drop, key.Ctrl); return true; case KeyboardCommands.Clear: model.RemoveChunkHere(); return true; case KeyboardCommands.NewEpisodeHere: model.NewEpisodeHere(); return true; } return false; }
public static bool NavigationKeysProcessing(EditorModel model, KeyboardCommandData key) { var delta = 1000; if (key.Shift) delta = 200; if (key.Ctrl) delta = 50; switch (key.Command) { case KeyboardCommands.Left: model.WindowState.CurrentPosition = ((int)(model.WindowState.CurrentPosition - delta)); return true; case KeyboardCommands.Right: model.WindowState.CurrentPosition = ((int)(model.WindowState.CurrentPosition + delta)); return true; case KeyboardCommands.PauseResume: model.WindowState.Paused = !model.WindowState.Paused; return true; } return false; }
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; } }
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; } }
public void ProcessKey(KeyboardCommandData key) { if (this.ProcessNavigationKey(key)) { return; } if (this.ProcessCommonMarkupKey(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; FastSpeed = Math.Max(0.5, FastSpeed); return; case KeyboardCommands.SpeedUp: FastSpeed += 0.5; FastSpeed = Math.Min(3, FastSpeed); return; case KeyboardCommands.Face: Model.MarkHere(Mode.Face, key.Ctrl); return; case KeyboardCommands.Desktop: Model.MarkHere(Mode.Desktop, key.Ctrl); return; case KeyboardCommands.Drop: Model.MarkHere(Mode.Drop, key.Ctrl); return; case KeyboardCommands.Clear: Model.RemoveChunkHere(); 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; } }
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; } }
public void ProcessKey(KeyboardCommandData key) { var shiftValue = 200; if (key.Shift || key.Ctrl) { shiftValue = 50; } if (this.ProcessNavigationKey(key)) { return; } if (this.ProcessCommonMarkupKey(key)) { return; } if (this.DefaultSpeedKey(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.Face: Model.MarkHere(Mode.Face, key.Ctrl); Model.WindowState.ArrangeMode = ArrangeModes.BothFaceBigger; return; case KeyboardCommands.Desktop: Model.MarkHere(Mode.Desktop, key.Ctrl); Model.WindowState.ArrangeMode = ArrangeModes.BothDesktopBigger; return; case KeyboardCommands.Drop: Model.MarkHere(Mode.Drop, key.Ctrl); return; case KeyboardCommands.Clear: Model.RemoveChunkHere(); return; } }