Add alt/ctrl + arrow keys move to assa set pos

This commit is contained in:
niksedk 2021-06-22 12:46:15 +02:00
parent 55de09680d
commit c1148582f0

View File

@ -85,6 +85,36 @@ namespace Nikse.SubtitleEdit.Forms.Assa
UiUtil.OpenUrl("https://www.nikse.dk/SubtitleEdit/AssaOverrideTags#pos"); UiUtil.OpenUrl("https://www.nikse.dk/SubtitleEdit/AssaOverrideTags#pos");
e.SuppressKeyPress = true; e.SuppressKeyPress = true;
} }
if (e.Modifiers == Keys.Alt || e.Modifiers == Keys.Control)
{
var v = e.Modifiers == Keys.Alt ? 1 : 10;
if (e.KeyCode == Keys.Up && _x != -1 && _y != -1)
{
_y -= v;
e.SuppressKeyPress = true;
VideoLoaded(null, null);
}
else if (e.KeyCode == Keys.Down && _x != -1 && _y != -1)
{
_y += v;
e.SuppressKeyPress = true;
VideoLoaded(null, null);
}
else if (e.KeyCode == Keys.Left && _x != -1 && _y != -1)
{
_x -= v;
e.SuppressKeyPress = true;
VideoLoaded(null, null);
}
else if (e.KeyCode == Keys.Right && _x != -1 && _y != -1)
{
_x += v;
e.SuppressKeyPress = true;
VideoLoaded(null, null);
}
}
} }
private void buttonOK_Click(object sender, EventArgs e) private void buttonOK_Click(object sender, EventArgs e)
@ -207,8 +237,8 @@ namespace Nikse.SubtitleEdit.Forms.Assa
var subtitle = new Subtitle(); var subtitle = new Subtitle();
var indices = GetIndices(subtitle); var indices = GetIndices(subtitle);
var styleToApply = $"{{\\pos({_x},{_y})}}"; var styleToApply = $"{{\\pos({_x},{_y})}}";
var p = indices.Length > 0 ? var p = indices.Length > 0 ?
new Paragraph(_subtitleWithNewHeader.Paragraphs[indices[0]]) : new Paragraph(_subtitleWithNewHeader.Paragraphs[indices[0]]) :
new Paragraph(Configuration.Settings.General.PreviewAssaText, 0, 1000); new Paragraph(Configuration.Settings.General.PreviewAssaText, 0, 1000);
// remove old position tags // remove old position tags