mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 05:02:36 +01:00
Added setting to control waveform-mouse-wheel-scroll direction
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@353 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
a4bd67f94e
commit
69f6ed81fe
@ -38,6 +38,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
public delegate void ParagraphChangedHandler(Paragraph paragraph);
|
||||
public event ParagraphChangedHandler OnNewSelectionRightClicked;
|
||||
public event PositionChangedEventHandler OnParagraphRightClicked;
|
||||
public event PositionChangedEventHandler OnNonParagraphRightClicked;
|
||||
|
||||
public delegate void PositionChangedEventHandler(double seconds, Paragraph paragraph);
|
||||
public event PositionChangedEventHandler OnPositionSelected;
|
||||
@ -51,6 +52,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
public event EventHandler OnPause;
|
||||
public event EventHandler OnZoomedChanged;
|
||||
|
||||
public bool MouseWheelScrollUpIsForward = true;
|
||||
public const double ZoomMininum = 0.1;
|
||||
public const double ZoomMaxinum = 2.5;
|
||||
private double _zoomFactor = 1.0; // 1.0=no zoom
|
||||
@ -545,15 +547,25 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (OnParagraphRightClicked != null)
|
||||
else
|
||||
{
|
||||
Paragraph p = GetParagraphAtMilliseconds(milliseconds);
|
||||
RightClickedParagraph = p;
|
||||
RightClickedSeconds = seconds;
|
||||
if (p != null)
|
||||
{
|
||||
NewSelectionParagraph = null;
|
||||
OnParagraphRightClicked.Invoke(seconds, p);
|
||||
if (OnParagraphRightClicked != null)
|
||||
{
|
||||
NewSelectionParagraph = null;
|
||||
OnParagraphRightClicked.Invoke(seconds, p);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OnNonParagraphRightClicked != null)
|
||||
{
|
||||
OnNonParagraphRightClicked.Invoke(seconds, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1002,6 +1014,8 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
void WaveForm_MouseWheel(object sender, MouseEventArgs e)
|
||||
{
|
||||
int delta = e.Delta;
|
||||
if (!MouseWheelScrollUpIsForward)
|
||||
delta = delta * -1;
|
||||
if (Locked)
|
||||
{
|
||||
OnPositionSelected.Invoke(_currentVideoPositionSeconds + (delta / 256.0), null);
|
||||
|
@ -105,7 +105,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (versionInfo.Length >= 3 && versionInfo[2] != "0")
|
||||
_title += "." + versionInfo[2];
|
||||
}
|
||||
return _title + " RC4";
|
||||
return _title;
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,6 +268,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
AudioWaveForm.OnTimeChanged += AudioWaveForm_OnTimeChanged;
|
||||
AudioWaveForm.OnNewSelectionRightClicked += AudioWaveForm_OnNewSelectionRightClicked;
|
||||
AudioWaveForm.OnParagraphRightClicked += AudioWaveForm_OnParagraphRightClicked;
|
||||
AudioWaveForm.OnNonParagraphRightClicked += new WaveForm.PositionChangedEventHandler(AudioWaveForm_OnNonParagraphRightClicked);
|
||||
AudioWaveForm.OnSingleClick += AudioWaveForm_OnSingleClick;
|
||||
AudioWaveForm.OnPause += AudioWaveForm_OnPause;
|
||||
AudioWaveForm.OnTimeChangedAndOffsetRest += AudioWaveForm_OnTimeChangedAndOffsetRest;
|
||||
@ -278,6 +279,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
AudioWaveForm.Color = Configuration.Settings.VideoControls.WaveFormColor;
|
||||
AudioWaveForm.BackgroundColor = Configuration.Settings.VideoControls.WaveFormBackgroundColor;
|
||||
AudioWaveForm.TextColor = Configuration.Settings.VideoControls.WaveFormTextColor;
|
||||
AudioWaveForm.MouseWheelScrollUpIsForward = Configuration.Settings.VideoControls.WaveFormMouseWheelScrollUpIsForward;
|
||||
|
||||
for (double zoomCounter = WaveForm.ZoomMininum; zoomCounter <= WaveForm.ZoomMaxinum + (0.001); zoomCounter += 0.1)
|
||||
{
|
||||
@ -299,6 +301,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
void AudioWaveForm_OnNonParagraphRightClicked(double seconds, Paragraph paragraph)
|
||||
{
|
||||
if (Configuration.Settings.VideoControls.WaveFormDoubleClickOnNonParagraphAction == "ButtonSetStartAndOffsetRest")
|
||||
{
|
||||
mediaPlayer.CurrentPosition = seconds;
|
||||
ButtonSetStartAndOffsetRestClick(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioWaveForm_OnDoubleClickNonParagraph(double seconds, Paragraph paragraph)
|
||||
{
|
||||
if (mediaPlayer.VideoPlayer != null)
|
||||
@ -5317,6 +5328,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
internal void Main_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Modifiers == Keys.Alt && e.KeyCode == (Keys.RButton | Keys.ShiftKey) && textBoxListViewText.Focused)
|
||||
{ // annoying that focus leaves textbox while typing, when pressing Alt alone
|
||||
e.SuppressKeyPress = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.Insert)
|
||||
{
|
||||
InsertAfter();
|
||||
@ -5651,7 +5668,26 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (tabControlButtons.SelectedTab == tabPageCreate && mediaPlayer.VideoPlayer != null)
|
||||
{
|
||||
if (e.Modifiers == Keys.None && e.KeyCode == Keys.F9)
|
||||
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.F9)
|
||||
{
|
||||
InsertNewTextAtVideoPosition();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.Modifiers == Keys.Shift && e.KeyCode == Keys.F9)
|
||||
{
|
||||
var p = InsertNewTextAtVideoPosition();
|
||||
p.Text = p.StartTime.ToShortString();
|
||||
SubtitleListview1.SetText(_subtitle.GetIndex(p), p.Text);
|
||||
textBoxListViewText.Text = p.Text;
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.F9)
|
||||
{
|
||||
StopAutoDuration();
|
||||
buttonSetEnd_Click(null, null);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.Modifiers == Keys.None && e.KeyCode == Keys.F9)
|
||||
{
|
||||
buttonInsertNewText_Click(null, null);
|
||||
e.SuppressKeyPress = true;
|
||||
@ -6954,13 +6990,23 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
mediaPlayer.Pause();
|
||||
|
||||
var newParagraph = InsertNewTextAtVideoPosition();
|
||||
|
||||
textBoxListViewText.Focus();
|
||||
timerAutoDuration.Start();
|
||||
|
||||
ShowStatus(string.Format(_language.VideoControls.NewTextInsertAtX, newParagraph.StartTime.ToShortString()));
|
||||
}
|
||||
|
||||
private Paragraph InsertNewTextAtVideoPosition()
|
||||
{
|
||||
// current movie pos
|
||||
double totalMilliseconds = mediaPlayer.CurrentPosition * 1000.0;
|
||||
|
||||
int startNumber = 1;
|
||||
if (_subtitle.Paragraphs.Count > 0)
|
||||
startNumber = _subtitle.Paragraphs[0].Number;
|
||||
|
||||
// current movie pos
|
||||
double totalMilliseconds = mediaPlayer.CurrentPosition * 1000.0;
|
||||
|
||||
TimeCode tc = new TimeCode(TimeSpan.FromMilliseconds(totalMilliseconds));
|
||||
MakeHistoryForUndo(_language.BeforeInsertSubtitleAtVideoPosition + " " + tc.ToString());
|
||||
|
||||
@ -6986,11 +7032,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_subtitle.Renumber(startNumber);
|
||||
SubtitleListview1.Fill(_subtitle.Paragraphs);
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(index);
|
||||
|
||||
textBoxListViewText.Focus();
|
||||
timerAutoDuration.Start();
|
||||
|
||||
ShowStatus(string.Format(_language.VideoControls.NewTextInsertAtX, newParagraph.StartTime.ToShortString()));
|
||||
return newParagraph;
|
||||
}
|
||||
|
||||
private void timerAutoDuration_Tick(object sender, EventArgs e)
|
||||
|
@ -684,7 +684,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAASABAwEgAQMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAASgBAwEoAQMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
@ -277,12 +277,12 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
DefaultEncoding = "UTF-8";
|
||||
AutoGuessAnsiEncoding = false;
|
||||
ShowRecentFiles = true;
|
||||
RememberSelectedLine = false;
|
||||
RememberSelectedLine = true;
|
||||
StartLoadLastFile = true;
|
||||
StartRememberPositionAndSize = true;
|
||||
SubtitleLineMaximumLength = 43;
|
||||
MininumMillisecondsBetweenLines = 25;
|
||||
AutoWrapLineWhileTyping = true;
|
||||
AutoWrapLineWhileTyping = false;
|
||||
SubtitleMaximumCharactersPerSeconds = 25;
|
||||
SpellCheckLanguage = null;
|
||||
VideoPlayer = string.Empty;
|
||||
@ -314,6 +314,8 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public Color WaveFormBackgroundColor { get; set; }
|
||||
public Color WaveFormTextColor { get; set; }
|
||||
public string WaveFormDoubleClickOnNonParagraphAction { get; set; }
|
||||
public string WaveFormRightClickOnNonParagraphAction { get; set; }
|
||||
public bool WaveFormMouseWheelScrollUpIsForward { get; set; }
|
||||
|
||||
public VideoControlsSettings()
|
||||
{
|
||||
@ -327,6 +329,8 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
WaveFormBackgroundColor = Color.Black;
|
||||
WaveFormTextColor = Color.Gray;
|
||||
WaveFormDoubleClickOnNonParagraphAction = "PlayPause";
|
||||
WaveFormDoubleClickOnNonParagraphAction = string.Empty;
|
||||
WaveFormMouseWheelScrollUpIsForward = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -884,7 +888,13 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
settings.VideoControls.WaveFormTextColor = Color.FromArgb(int.Parse(subNode.InnerText));
|
||||
subNode = node.SelectSingleNode("WaveFormDoubleClickOnNonParagraphAction");
|
||||
if (subNode != null)
|
||||
settings.VideoControls.WaveFormDoubleClickOnNonParagraphAction = subNode.InnerText;
|
||||
settings.VideoControls.WaveFormDoubleClickOnNonParagraphAction = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("WaveFormRightClickOnNonParagraphAction");
|
||||
if (subNode != null)
|
||||
settings.VideoControls.WaveFormRightClickOnNonParagraphAction = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("WaveFormMouseWheelScrollUpIsForward");
|
||||
if (subNode != null)
|
||||
settings.VideoControls.WaveFormMouseWheelScrollUpIsForward = Convert.ToBoolean(subNode.InnerText);
|
||||
|
||||
settings.NetworkSettings = new NetworkSettings();
|
||||
node = doc.DocumentElement.SelectSingleNode("NetworkSettings");
|
||||
@ -1133,6 +1143,8 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
textWriter.WriteElementString("WaveFormBackgroundColor", settings.VideoControls.WaveFormBackgroundColor.ToArgb().ToString());
|
||||
textWriter.WriteElementString("WaveFormTextColor", settings.VideoControls.WaveFormTextColor.ToArgb().ToString());
|
||||
textWriter.WriteElementString("WaveFormDoubleClickOnNonParagraphAction", settings.VideoControls.WaveFormDoubleClickOnNonParagraphAction);
|
||||
textWriter.WriteElementString("WaveFormRightClickOnNonParagraphAction", settings.VideoControls.WaveFormRightClickOnNonParagraphAction);
|
||||
textWriter.WriteElementString("WaveFormMouseWheelScrollUpIsForward", settings.VideoControls.WaveFormMouseWheelScrollUpIsForward.ToString());
|
||||
|
||||
textWriter.WriteEndElement();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user