Disable selection in "Adjust all times" when in "source view"

Fix #8695
This commit is contained in:
Nikolaj Olsson 2024-08-02 16:20:46 +02:00
parent 7de7b63678
commit 8be8e413ab
5 changed files with 49 additions and 7 deletions

View File

@ -16,7 +16,8 @@
* Update French translation - thx Pierre
* Update Greek translation - thx PMitsakis
* Allow for larger files via drop to list view - thx Jim
* Improve "Generate transparent video with subs" box settings - thx JeditPro
* Improve "Generate transparent video with subs" box settings - thx JeditPro
* Disable line selection options in "Adjust all times" when in "source view"
* FIXED:
* Fix crash in TTML IMSC 1.1 - thx Louie
* Fix Romanian translation version number - thx MediaExpres

View File

@ -16805,6 +16805,8 @@ namespace Nikse.SubtitleEdit.Forms
timerWaveform.Stop();
_showEarlierOrLater = new ShowEarlierLater();
_showEarlierOrLater.AllowSelection += ShowEarlierOrLaterAllowSelection;
if (!_showEarlierOrLater.IsPositionAndSizeSaved)
{
_showEarlierOrLater.Top = Top + 100;
@ -16820,6 +16822,11 @@ namespace Nikse.SubtitleEdit.Forms
RefreshSelectedParagraph();
}
private void ShowEarlierOrLaterAllowSelection(object sender, ShowEarlierLater.ViewStatus viewStatus)
{
viewStatus.AllowSelection = InListView;
}
internal void MainKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.LWin)
@ -25491,6 +25498,8 @@ namespace Nikse.SubtitleEdit.Forms
}
_showEarlierOrLater = new ShowEarlierLater();
_showEarlierOrLater.AllowSelection += ShowEarlierOrLaterAllowSelection;
if (!_showEarlierOrLater.IsPositionAndSizeSaved)
{
_showEarlierOrLater.Top = Top + 100;

View File

@ -37,7 +37,7 @@ namespace Nikse.SubtitleEdit.Forms
this.buttonShowLater = new System.Windows.Forms.Button();
this.buttonShowEarlier = new System.Windows.Forms.Button();
this.labelTotalAdjustment = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timerRefreshAllowSelection = new System.Windows.Forms.Timer(this.components);
this.radioButtonAllLines = new System.Windows.Forms.RadioButton();
this.radioButtonSelectedLinesOnly = new System.Windows.Forms.RadioButton();
this.timeUpDownAdjust = new Nikse.SubtitleEdit.Controls.NikseTimeUpDown();
@ -82,9 +82,10 @@ namespace Nikse.SubtitleEdit.Forms
this.labelTotalAdjustment.TabIndex = 38;
this.labelTotalAdjustment.Text = "labelTotalAdjustment";
//
// timer1
// timerRefreshAllowSelection
//
this.timer1.Interval = 250;
this.timerRefreshAllowSelection.Interval = 250;
this.timerRefreshAllowSelection.Tick += new System.EventHandler(this.timerRefreshAllowSelection_Tick);
//
// radioButtonAllLines
//
@ -188,7 +189,7 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.Button buttonShowLater;
private System.Windows.Forms.Button buttonShowEarlier;
private System.Windows.Forms.Label labelTotalAdjustment;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer timerRefreshAllowSelection;
private System.Windows.Forms.RadioButton radioButtonAllLines;
private System.Windows.Forms.RadioButton radioButtonSelectedLinesOnly;
private System.Windows.Forms.RadioButton radioButtonSelectedLineAndForward;

View File

@ -8,8 +8,14 @@ namespace Nikse.SubtitleEdit.Forms
{
public sealed partial class ShowEarlierLater : PositionAndSizeForm
{
public delegate void AdjustEventHandler(double adjustMilliseconds, SelectionChoice selection);
public class ViewStatus
{
public bool AllowSelection { get; set; }
}
public delegate void AdjustEventHandler(double adjustMilliseconds, SelectionChoice selection);
public delegate void AllowSelectionHandler(object sender, ViewStatus viewStatus);
public event AllowSelectionHandler AllowSelection;
private TimeSpan _totalAdjustment;
private AdjustEventHandler _adjustCallback;
@ -42,6 +48,8 @@ namespace Nikse.SubtitleEdit.Forms
});
}
};
timerRefreshAllowSelection.Start();
}
public void ResetTotalAdjustment()
@ -147,7 +155,30 @@ namespace Nikse.SubtitleEdit.Forms
private void ShowEarlierLater_FormClosing(object sender, FormClosingEventArgs e)
{
timerRefreshAllowSelection.Stop();
Configuration.Settings.Tools.LastShowEarlierOrLaterSelection = GetSelectionChoice().ToString();
}
private void timerRefreshAllowSelection_Tick(object sender, EventArgs e)
{
if (AllowSelection != null)
{
var viewStatus = new ViewStatus { AllowSelection = radioButtonAllLines.Enabled };
AllowSelection.Invoke(this, viewStatus);
if (viewStatus.AllowSelection)
{
radioButtonSelectedLinesOnly.Enabled = true;
radioButtonSelectedLineAndForward.Enabled = true;
radioButtonAllLines.Enabled = true;
}
else
{
radioButtonSelectedLinesOnly.Enabled = false;
radioButtonSelectedLineAndForward.Enabled = false;
radioButtonAllLines.Enabled = false;
radioButtonAllLines.Checked = true;
}
}
}
}
}

View File

@ -117,7 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="timerRefreshAllowSelection.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>