Fixing shortcuts from 72bcc93c74 + added an extra one

This commit is contained in:
Nikolaj Olsson 2016-08-07 10:38:43 +02:00
parent 3405755824
commit f1db81ded2
9 changed files with 99 additions and 45 deletions

View File

@ -1828,6 +1828,7 @@ can edit in same subtitle file (collaboration)</Information>
<AdjustSetStartTimeKeepDuration>Set start time, keep duration</AdjustSetStartTimeKeepDuration>
<AdjustSetEndAndOffsetTheRest>Set end, offset the rest</AdjustSetEndAndOffsetTheRest>
<AdjustSetEndAndOffsetTheRestAndGoToNext>Set end, offset the rest and go to next</AdjustSetEndAndOffsetTheRestAndGoToNext>
<AdjustExtendCurrentSubtitle>Extend current line to next subtitle or max duration</AdjustExtendCurrentSubtitle>
<MainCreateStartDownEndUp>Create new at key-down, set end time at key-up</MainCreateStartDownEndUp>
<MergeDialog>Merge dialog (insert dashes)</MergeDialog>
<GoToNext>Go to next line</GoToNext>
@ -1835,7 +1836,6 @@ can edit in same subtitle file (collaboration)</Information>
<GoToCurrentSubtitleStart>Go to current line start</GoToCurrentSubtitleStart>
<GoToCurrentSubtitleEnd>Go to current line end</GoToCurrentSubtitleEnd>
<GoToNextSubtitleAndFocusVideo>Go to next line and set video position</GoToNextSubtitleAndFocusVideo>
<ExtendCurrentSubtitle>Extend current line to next subtitle or max duration</ExtendCurrentSubtitle>
<ToggleFocus>Toggle focus between list view and subtitle text box</ToggleFocus>
<ToggleDialogDashes>Toggle dialog dashes</ToggleDialogDashes>
<Alignment>Alignment (selected lines)</Alignment>
@ -1854,6 +1854,7 @@ can edit in same subtitle file (collaboration)</Information>
<WaveformPlayFirstSelectedSubtitle>Play first selected subtitle</WaveformPlayFirstSelectedSubtitle>
<WaveformFocusListView>Focus list view</WaveformFocusListView>
<WaveformGoToNextSceneChange>Go to next scene change</WaveformGoToNextSceneChange>
<WaveformToggleSceneChange>Toggle scene change</WaveformToggleSceneChange>
<GoBack1Frame>One frame back</GoBack1Frame>
<GoForward1Frame>One frame forward</GoForward1Frame>
<GoBack100Milliseconds>100 ms back</GoBack100Milliseconds>

View File

@ -2117,7 +2117,7 @@ can edit in same subtitle file (collaboration)",
GoToCurrentSubtitleStart = "Go to current line start",
GoToCurrentSubtitleEnd = "Go to current line end",
GoToNextSubtitleAndFocusVideo = "Go to next line and set video position",
ExtendCurrentSubtitle = "Extend current line to next subtitle or max duration",
AdjustExtendCurrentSubtitle = "Extend current line to next subtitle or max duration",
ToggleFocus = "Toggle focus between list view and subtitle text box",
ToggleDialogDashes = "Toggle dialog dashes",
Alignment = "Alignment (selected lines)",
@ -2136,6 +2136,7 @@ can edit in same subtitle file (collaboration)",
WaveformPlayFirstSelectedSubtitle = "Play first selected subtitle",
WaveformFocusListView = "Focus list view",
WaveformGoToNextSceneChange = "Go to next scene change",
WaveformToggleSceneChange = "Toggle scene change",
GoBack1Frame = "One frame back",
GoForward1Frame = "One frame forward",
GoBack100Milliseconds = "100 ms back",

View File

@ -4933,6 +4933,9 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/AdjustSetEndAndOffsetTheRestAndGoToNext":
language.Settings.AdjustSetEndAndOffsetTheRestAndGoToNext = reader.Value;
break;
case "Settings/AdjustExtendCurrentSubtitle":
language.Settings.AdjustExtendCurrentSubtitle = reader.Value;
break;
case "Settings/MainCreateStartDownEndUp":
language.Settings.MainCreateStartDownEndUp = reader.Value;
break;
@ -4954,9 +4957,6 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/GoToNextSubtitleAndFocusVideo":
language.Settings.GoToNextSubtitleAndFocusVideo = reader.Value;
break;
case "Settings/ExtendCurrentSubtitle":
language.Settings.ExtendCurrentSubtitle = reader.Value;
break;
case "Settings/ToggleFocus":
language.Settings.ToggleFocus = reader.Value;
break;
@ -5011,6 +5011,9 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/WaveformGoToNextSceneChange":
language.Settings.WaveformGoToNextSceneChange = reader.Value;
break;
case "Settings/WaveformToggleSceneChange":
language.Settings.WaveformToggleSceneChange = reader.Value;
break;
case "Settings/GoBack1Frame":
language.Settings.GoBack1Frame = reader.Value;
break;

View File

@ -1990,6 +1990,7 @@
public string AdjustSetStartTimeKeepDuration { get; set; }
public string AdjustSetEndAndOffsetTheRest { get; set; }
public string AdjustSetEndAndOffsetTheRestAndGoToNext { get; set; }
public string AdjustExtendCurrentSubtitle { get; set; }
public string MainCreateStartDownEndUp { get; set; }
public string MergeDialog { get; set; }
public string GoToNext { get; set; }
@ -1997,7 +1998,6 @@
public string GoToCurrentSubtitleStart { get; set; }
public string GoToCurrentSubtitleEnd { get; set; }
public string GoToNextSubtitleAndFocusVideo { get; set; }
public string ExtendCurrentSubtitle { get; set; }
public string ToggleFocus { get; set; }
public string ToggleDialogDashes { get; set; }
public string Alignment { get; set; }
@ -2016,6 +2016,7 @@
public string WaveformPlayFirstSelectedSubtitle { get; set; }
public string WaveformFocusListView { get; set; }
public string WaveformGoToNextSceneChange { get; set; }
public string WaveformToggleSceneChange { get; set; }
public string GoBack1Frame { get; set; }
public string GoForward1Frame { get; set; }
public string GoBack100Milliseconds { get; set; }

View File

@ -933,6 +933,7 @@ namespace Nikse.SubtitleEdit.Core
public string WaveformAddTextHereFromClipboard { get; set; }
public string WaveformFocusListView { get; set; }
public string WaveformGoToNextSceneChange { get; set; }
public string WaveformToggleSceneChange { get; set; }
public string MainTranslateCustomSearch1 { get; set; }
public string MainTranslateCustomSearch2 { get; set; }
public string MainTranslateCustomSearch3 { get; set; }
@ -2749,6 +2750,9 @@ namespace Nikse.SubtitleEdit.Core
subNode = node.SelectSingleNode("WaveformGoToNextSceneChange");
if (subNode != null)
settings.Shortcuts.WaveformGoToNextSceneChange = subNode.InnerText;
subNode = node.SelectSingleNode("WaveformToggleSceneChange");
if (subNode != null)
settings.Shortcuts.WaveformToggleSceneChange = subNode.InnerText;
subNode = node.SelectSingleNode("MainTranslateCustomSearch1");
if (subNode != null)
settings.Shortcuts.MainTranslateCustomSearch1 = subNode.InnerText;
@ -3390,6 +3394,7 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("WaveformAddTextHereFromClipboard", settings.Shortcuts.WaveformAddTextHereFromClipboard);
textWriter.WriteElementString("WaveformFocusListView", settings.Shortcuts.WaveformFocusListView);
textWriter.WriteElementString("WaveformGoToNextSceneChange", settings.Shortcuts.WaveformGoToNextSceneChange);
textWriter.WriteElementString("WaveformToggleSceneChange", settings.Shortcuts.WaveformToggleSceneChange);
textWriter.WriteElementString("MainTranslateCustomSearch1", settings.Shortcuts.MainTranslateCustomSearch1);
textWriter.WriteElementString("MainTranslateCustomSearch2", settings.Shortcuts.MainTranslateCustomSearch2);
textWriter.WriteElementString("MainTranslateCustomSearch3", settings.Shortcuts.MainTranslateCustomSearch3);

View File

@ -505,21 +505,38 @@ namespace Nikse.SubtitleEdit.Controls
DrawTimeLine(graphics, waveformHeight);
}
int currentPositionPos = SecondsToXPosition(_currentVideoPositionSeconds - StartPositionSeconds);
bool currentPosDone = false;
// scene changes
if (_sceneChanges != null)
{
try
{
foreach (double time in _sceneChanges)
int index = 0;
while (index < _sceneChanges.Count)
{
double time = _sceneChanges[index++];
int pos = SecondsToXPosition(time - StartPositionSeconds);
if (pos > 0 && pos < Width)
{
if (Math.Abs(currentPositionPos - pos) < 0.01)
{ // scene change and current pos is the save - draw 2 pixels + current pos dotted
currentPosDone = true;
using (var p = new Pen(Color.AntiqueWhite, 2))
graphics.DrawLine(p, pos, 0, pos, Height);
using (var p = new Pen(Color.Turquoise, 2) { DashStyle = DashStyle.Dash })
graphics.DrawLine(p, currentPositionPos, 0, currentPositionPos, Height);
}
else
{
using (var p = new Pen(Color.AntiqueWhite))
graphics.DrawLine(p, pos, 0, pos, Height);
}
}
}
}
catch (Exception)
{
// ignored
@ -527,13 +544,12 @@ namespace Nikse.SubtitleEdit.Controls
}
// current video position
if (_currentVideoPositionSeconds > 0)
if (_currentVideoPositionSeconds > 0 && !currentPosDone)
{
int pos = SecondsToXPosition(_currentVideoPositionSeconds - StartPositionSeconds);
if (pos > 0 && pos < Width)
if (currentPositionPos > 0 && currentPositionPos < Width)
{
using (var p = new Pen(Color.Turquoise))
graphics.DrawLine(p, pos, 0, pos, Height);
graphics.DrawLine(p, currentPositionPos, 0, currentPositionPos, Height);
}
}

View File

@ -150,7 +150,7 @@ namespace Nikse.SubtitleEdit.Forms
private Keys _videoPlayFirstSelected = Keys.None;
private Keys _mainVideoFullscreen = Keys.None;
private Keys _mainGoToNextSubtitleAndFocusVideo = Keys.None;
private Keys _mainExtendCurrentSubtitle = Keys.None;
private Keys _mainAdjustExtendCurrentSubtitle = Keys.None;
private Keys _mainTextBoxSplitAtCursor = Keys.None;
private Keys _mainTextBoxMoveLastWordDown = Keys.None;
private Keys _mainTextBoxMoveFirstWordFromNextUp = Keys.None;
@ -201,6 +201,7 @@ namespace Nikse.SubtitleEdit.Forms
private Keys _waveformAddTextAtHereFromClipboard = Keys.None;
private Keys _waveformFocusListView = Keys.None;
private Keys _waveformGoToNextSceneChange = Keys.None;
private Keys _waveformToggleSceneChange = Keys.None;
private Keys _mainTranslateCustomSearch1 = Keys.None;
private Keys _mainTranslateCustomSearch2 = Keys.None;
private Keys _mainTranslateCustomSearch3 = Keys.None;
@ -10872,7 +10873,7 @@ namespace Nikse.SubtitleEdit.Forms
}
e.SuppressKeyPress = true;
}
else if (_mainGeneralGoToStartOfCurrentSubtitle == e.KeyData)
else if (_mainGoToNextSubtitleAndFocusVideo == e.KeyData)
{
int newIndex = _subtitleListViewIndex + 1;
if (newIndex < _subtitle.Paragraphs.Count)
@ -10889,26 +10890,6 @@ namespace Nikse.SubtitleEdit.Forms
e.SuppressKeyPress = true;
}
}
else if (_mainExtendCurrentSubtitle == e.KeyData)
{
if (SubtitleListview1.SelectedItems.Count == 1)
{
var idx = SubtitleListview1.SelectedItems[0].Index;
var p = _subtitle.Paragraphs[idx];
var next = _subtitle.GetParagraphOrDefault(idx + 1);
if (next == null || next.StartTime.TotalMilliseconds > p.EndTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines)
{
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
}
else if (next != null && next.StartTime.TotalMilliseconds > p.EndTime.TotalMilliseconds)
{
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
}
RefreshSelectedParagraph();
e.SuppressKeyPress = true;
}
e.SuppressKeyPress = true;
}
else if (_mainGeneralFileSaveAll == e.KeyData)
{
ToolStripButtonSaveClick(sender, e);
@ -11289,6 +11270,7 @@ namespace Nikse.SubtitleEdit.Forms
else if (e.KeyData == _mainVideoFullscreen) // fullscreen
{
GoFullscreen();
e.SuppressKeyPress = true;
}
else if (audioVisualizer.Focused && audioVisualizer.NewSelectionParagraph != null && e.KeyData == _waveformAddTextAtHere)
{
@ -11318,6 +11300,28 @@ namespace Nikse.SubtitleEdit.Forms
}
e.SuppressKeyPress = true;
}
else if (audioVisualizer.SceneChanges != null && mediaPlayer.IsPaused && e.KeyData == _waveformToggleSceneChange)
{
var cp = mediaPlayer.CurrentPosition;
var idx = GetSceneChangeIndex(cp);
if (idx >= 0)
{ // remove scene change
if (idx < audioVisualizer.SceneChanges.Count)
{
audioVisualizer.SceneChanges[idx] = -1;
SceneChangeHelper.SaveSceneChanges(_videoFileName, audioVisualizer.SceneChanges.Where(p => p > 0).ToList());
}
}
else
{ // add scene change
var list = audioVisualizer.SceneChanges.Where(p => p > 0).ToList();
list.Add(cp);
list.Sort();
audioVisualizer.SceneChanges = list;
SceneChangeHelper.SaveSceneChanges(_videoFileName, list);
}
e.SuppressKeyPress = true;
}
else if (audioVisualizer.Focused && e.KeyCode == Keys.Delete)
{
ToolStripMenuItemDeleteClick(null, null);
@ -11382,6 +11386,26 @@ namespace Nikse.SubtitleEdit.Forms
SetEndAndOffsetTheRest(true);
e.SuppressKeyPress = true;
}
else if (_mainAdjustExtendCurrentSubtitle == e.KeyData)
{
if (SubtitleListview1.SelectedItems.Count == 1)
{
var idx = SubtitleListview1.SelectedItems[0].Index;
var p = _subtitle.Paragraphs[idx];
var next = _subtitle.GetParagraphOrDefault(idx + 1);
if (next == null || next.StartTime.TotalMilliseconds > p.EndTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines)
{
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
}
else if (next != null && next.StartTime.TotalMilliseconds > p.EndTime.TotalMilliseconds)
{
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
}
RefreshSelectedParagraph();
e.SuppressKeyPress = true;
}
e.SuppressKeyPress = true;
}
else if (_mainAdjustSetEndAndGotoNext == e.KeyData)
{
ButtonSetEndAndGoToNextClick(null, null);
@ -11492,7 +11516,7 @@ namespace Nikse.SubtitleEdit.Forms
{
double videoPosition = mediaPlayer.CurrentPosition;
if (!mediaPlayer.IsPaused)
videoPosition -= Configuration.Settings.General.SetStartEndHumanDelay / TimeCode.BaseUnit;
videoPosition -= Configuration.Settings.General.SetStartEndHumanDelay/TimeCode.BaseUnit;
int index = SubtitleListview1.SelectedItems[0].Index;
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.VideoControls.BeforeChangingTimeInWaveformX, "#" + _subtitle.Paragraphs[index].Number + " " + _subtitle.Paragraphs[index].Text));
@ -14884,7 +14908,7 @@ namespace Nikse.SubtitleEdit.Forms
_video5000MsRight = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideo5000MsRight);
_videoPlayFirstSelected = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralPlayFirstSelected);
_mainGoToNextSubtitleAndFocusVideo = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo);
_mainExtendCurrentSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralExtendCurrentSubtitle);
_mainAdjustExtendCurrentSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralExtendCurrentSubtitle);
_mainVideoFullscreen = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoFullscreen);
spellCheckToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainSpellCheck);
@ -14955,6 +14979,8 @@ namespace Nikse.SubtitleEdit.Forms
_waveformAddTextAtHereFromClipboard = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformAddTextHereFromClipboard);
_waveformFocusListView = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformFocusListView);
_waveformGoToNextSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange);
_waveformToggleSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformToggleSceneChange);
_mainTranslateCustomSearch1 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch1);
_mainTranslateCustomSearch2 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch2);
_mainTranslateCustomSearch3 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch3);

View File

@ -655,7 +655,6 @@ namespace Nikse.SubtitleEdit.Forms
AddNode(generalNode, language.GoToCurrentSubtitleStart, nameof(Configuration.Settings.Shortcuts.GeneralGoToStartOfCurrentSubtitle));
AddNode(generalNode, language.GoToCurrentSubtitleEnd, nameof(Configuration.Settings.Shortcuts.GeneralGoToEndOfCurrentSubtitle));
AddNode(generalNode, language.GoToNextSubtitleAndFocusVideo, nameof(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo));
AddNode(generalNode, language.ExtendCurrentSubtitle, nameof(Configuration.Settings.Shortcuts.GeneralExtendCurrentSubtitle));
treeViewShortcuts.Nodes.Add(generalNode);
var fileNode = new TreeNode(Configuration.Settings.Language.Main.Menu.File.Title);
@ -788,6 +787,7 @@ namespace Nikse.SubtitleEdit.Forms
AddNode(adjustNode, language.AdjustSelected100MsBack, nameof(Configuration.Settings.Shortcuts.MainAdjustSelected100MsBack));
AddNode(adjustNode, language.AdjustSetEndAndOffsetTheRest, nameof(Configuration.Settings.Shortcuts.MainAdjustSetEndAndOffsetTheRest));
AddNode(adjustNode, language.AdjustSetEndAndOffsetTheRestAndGoToNext, nameof(Configuration.Settings.Shortcuts.MainAdjustSetEndAndOffsetTheRestAndGoToNext));
AddNode(adjustNode, language.AdjustExtendCurrentSubtitle, nameof(Configuration.Settings.Shortcuts.GeneralExtendCurrentSubtitle));
treeViewShortcuts.Nodes.Add(adjustNode);
var audioVisualizerNode = new TreeNode(language.WaveformAndSpectrogram);
@ -804,6 +804,7 @@ namespace Nikse.SubtitleEdit.Forms
AddNode(audioVisualizerNode, Configuration.Settings.Language.Main.VideoControls.InsertNewSubtitleAtVideoPosition, nameof(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition));
AddNode(audioVisualizerNode, language.WaveformFocusListView, nameof(Configuration.Settings.Shortcuts.WaveformFocusListView));
AddNode(audioVisualizerNode, language.WaveformGoToNextSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange));
AddNode(audioVisualizerNode, language.WaveformToggleSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformToggleSceneChange));
treeViewShortcuts.Nodes.Add(audioVisualizerNode);
foreach (TreeNode node in treeViewShortcuts.Nodes)

View File

@ -1836,7 +1836,7 @@ editar o mesmo ficheiro de legenda (colaboração)</Information>
<GoToCurrentSubtitleStart>Ir para o início da linha actual</GoToCurrentSubtitleStart>
<GoToCurrentSubtitleEnd>Ir para o final da linha actual</GoToCurrentSubtitleEnd>
<GoToNextSubtitleAndFocusVideo>Ir para a próxima linha e definir a posição de vídeo</GoToNextSubtitleAndFocusVideo>
<ExtendCurrentSubtitle>Alongar a linha actual até à próxima linha ou até à máxima duração</ExtendCurrentSubtitle>
<AdjustExtendCurrentSubtitle>Alongar a linha actual até à próxima linha ou até à máxima duração</AdjustExtendCurrentSubtitle>
<ToggleFocus>Alternar o realce entre a caixa de texto da legenda e o separador (Lista) na janela principal</ToggleFocus>
<ToggleDialogDashes>Alternar hífens de diálogo</ToggleDialogDashes>
<Alignment>Alinhamento (linhas seleccionadas)</Alignment>