From a3613d21b6cb09709222ebd3875e0672b6369817 Mon Sep 17 00:00:00 2001 From: niksedk Date: Mon, 25 Oct 2010 06:51:24 +0000 Subject: [PATCH] Refactored click events git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@75 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Controls/WaveForm.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Controls/WaveForm.cs b/src/Controls/WaveForm.cs index f3d26b3c9..509b55c13 100644 --- a/src/Controls/WaveForm.cs +++ b/src/Controls/WaveForm.cs @@ -46,7 +46,8 @@ namespace Nikse.SubtitleEdit.Controls public event TimeChangedEventHandler OnTimeChanged; public event TimeChangedEventHandler OnTimeChangedAndOffsetRest; - public event EventHandler OnTooglePlay; + public event TimeChangedEventHandler OnSingleClick; + public event TimeChangedEventHandler OnDoubleClickNonParagraph; public event EventHandler OnPause; public event EventHandler OnZoomedChanged; @@ -797,7 +798,7 @@ namespace Nikse.SubtitleEdit.Controls private void WaveForm_MouseDoubleClick(object sender, MouseEventArgs e) { - if (_wavePeaks == null || OnPositionSelected == null) + if (_wavePeaks == null) return; _mouseDown = false; @@ -846,7 +847,8 @@ namespace Nikse.SubtitleEdit.Controls } } - OnPositionSelected.Invoke(seconds, p); + if (OnDoubleClickNonParagraph != null) + OnDoubleClickNonParagraph.Invoke(seconds, p); } } @@ -860,7 +862,7 @@ namespace Nikse.SubtitleEdit.Controls private void WaveForm_MouseClick(object sender, MouseEventArgs e) { - if (e.Button == MouseButtons.Left && OnTooglePlay != null) + if (e.Button == MouseButtons.Left && OnSingleClick != null) { int diff = Math.Abs(_mouseMoveStartX - e.X); if (_mouseMoveStartX == -1 || _mouseMoveEndX == -1 || diff < 10 && TimeSpan.FromTicks(DateTime.Now.Ticks - _buttonDownTimeTicks).TotalSeconds < 0.25) @@ -927,7 +929,7 @@ namespace Nikse.SubtitleEdit.Controls } if (_mouseDownParagraphType == MouseDownParagraphType.None || _mouseDownParagraphType == MouseDownParagraphType.Whole) - OnTooglePlay.Invoke(sender, null); + OnSingleClick.Invoke(XPositionToSeconds(e.X), null); } } }