mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Try to improve disabled edit controls when no sub is loaded - thx darnn :)
Related to #5686
This commit is contained in:
parent
56a254e693
commit
c61afd21b4
3
src/ui/Forms/Main.Designer.cs
generated
3
src/ui/Forms/Main.Designer.cs
generated
@ -2569,7 +2569,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.toolStripMenuItemSelectedLines,
|
||||
this.toolStripMenuItemGoogleMicrosoftTranslateSelLine});
|
||||
this.contextMenuStripListView.Name = "contextMenuStripListView";
|
||||
this.contextMenuStripListView.Size = new System.Drawing.Size(285, 798);
|
||||
this.contextMenuStripListView.Size = new System.Drawing.Size(285, 776);
|
||||
this.contextMenuStripListView.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.MenuClosed);
|
||||
this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewOpening);
|
||||
this.contextMenuStripListView.Opened += new System.EventHandler(this.MenuOpened);
|
||||
@ -5483,6 +5483,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.ResizeEnd += new System.EventHandler(this.Main_ResizeEnd);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MainKeyDown);
|
||||
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.MainKeyUp);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Main_MouseDown);
|
||||
this.Resize += new System.EventHandler(this.Main_Resize);
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
|
@ -557,6 +557,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(_fileName))
|
||||
{
|
||||
EnableOrDisableEditControls();
|
||||
}
|
||||
|
||||
// Initialize events etc. for audio waveform
|
||||
audioVisualizer.OnDoubleClickNonParagraph += AudioWaveform_OnDoubleClickNonParagraph;
|
||||
audioVisualizer.OnPositionSelected += AudioWaveform_OnPositionSelected;
|
||||
@ -5047,15 +5052,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
_sourceViewChange = false;
|
||||
|
||||
_subtitleListViewIndex = -1;
|
||||
textBoxListViewText.Text = string.Empty;
|
||||
textBoxListViewTextOriginal.Text = string.Empty;
|
||||
textBoxListViewText.Enabled = false;
|
||||
textBoxListViewText.BackColor = SystemColors.ActiveBorder;
|
||||
textBoxListViewTextOriginal.BackColor = SystemColors.ActiveBorder;
|
||||
labelTextLineLengths.Text = string.Empty;
|
||||
labelCharactersPerSecond.Text = string.Empty;
|
||||
labelTextLineTotal.Text = string.Empty;
|
||||
//harboe _subtitleListViewIndex = -1;
|
||||
//textBoxListViewText.Text = string.Empty;
|
||||
//textBoxListViewTextOriginal.Text = string.Empty;
|
||||
//textBoxListViewText.Enabled = false;
|
||||
//textBoxListViewText.BackColor = SystemColors.ActiveBorder;
|
||||
//textBoxListViewTextOriginal.BackColor = SystemColors.ActiveBorder;
|
||||
//labelTextLineLengths.Text = string.Empty;
|
||||
//labelCharactersPerSecond.Text = string.Empty;
|
||||
//labelTextLineTotal.Text = string.Empty;
|
||||
EnableOrDisableEditControls();
|
||||
|
||||
_listViewTextUndoLast = null;
|
||||
_listViewOriginalTextUndoLast = null;
|
||||
@ -6968,8 +6974,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
MakeHistoryForUndo(_language.BeforeChangesMadeInSourceView);
|
||||
_sourceViewChange = false;
|
||||
_subtitle.Paragraphs.Clear();
|
||||
textBoxListViewText.Text = string.Empty;
|
||||
textBoxListViewText.Enabled = false;
|
||||
//harboe textBoxListViewText.Text = string.Empty;
|
||||
//textBoxListViewText.Enabled = false;
|
||||
EnableOrDisableEditControls();
|
||||
}
|
||||
|
||||
_subtitleListViewIndex = -1;
|
||||
@ -6991,8 +6998,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
MakeHistoryForUndo(_language.BeforeChangesMadeInSourceView);
|
||||
_subtitle.Paragraphs.Clear();
|
||||
SubtitleListview1.Items.Clear();
|
||||
textBoxListViewText.Text = string.Empty;
|
||||
textBoxListViewText.Enabled = false;
|
||||
//textBoxListViewText.Text = string.Empty;
|
||||
//textBoxListViewText.Enabled = false;
|
||||
EnableOrDisableEditControls();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -7779,6 +7787,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
timerOriginalTextUndo.Start();
|
||||
SetTitle();
|
||||
SetListViewStateImages();
|
||||
EnableOrDisableEditControls();
|
||||
}
|
||||
}
|
||||
|
||||
@ -9155,14 +9164,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
MakeHistoryForUndo(historyText);
|
||||
DeleteSelectedLines();
|
||||
|
||||
ResetTextInfoIfEmpty();
|
||||
EnableOrDisableEditControls();
|
||||
|
||||
ShowStatus(statusText);
|
||||
UpdateSourceView();
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetTextInfoIfEmpty()
|
||||
private void EnableOrDisableEditControls()
|
||||
{
|
||||
if (_subtitle.Paragraphs.Count == 0)
|
||||
{
|
||||
@ -9190,6 +9199,55 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
labelOriginalCharactersPerSecond.Text = string.Empty;
|
||||
labelTextOriginalLineLengths.Text = string.Empty;
|
||||
labelTextOriginalLineTotal.Text = string.Empty;
|
||||
numericUpDownDuration.Value = 0;
|
||||
timeUpDownStartTime.TimeCode = new TimeCode(0);
|
||||
|
||||
textBoxListViewText.Enabled = false;
|
||||
textBoxListViewTextOriginal.Enabled = false;
|
||||
timeUpDownStartTime.Enabled = false;
|
||||
numericUpDownDuration.Enabled = false;
|
||||
buttonPrevious.Enabled = false;
|
||||
buttonNext.Enabled = false;
|
||||
buttonUnBreak.Enabled = false;
|
||||
buttonAutoBreak.Enabled = false;
|
||||
if (!Configuration.Settings.General.UseDarkTheme)
|
||||
{
|
||||
labelText.Enabled = false;
|
||||
labelStartTime.Enabled = false;
|
||||
labelDuration.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var foreColor = Configuration.Settings.General.DarkThemeForeColor;
|
||||
var slightDarker = Color.FromArgb(Math.Max(0, foreColor.R - 75), Math.Max(0, foreColor.G - 75), Math.Max(0, foreColor.B - 75));
|
||||
labelText.ForeColor = slightDarker;
|
||||
labelStartTime.ForeColor = slightDarker;
|
||||
labelDuration.ForeColor = slightDarker;
|
||||
}
|
||||
}
|
||||
else if (!numericUpDownDuration.Enabled)
|
||||
{
|
||||
textBoxListViewText.BackColor = SystemColors.WindowFrame;
|
||||
textBoxListViewTextOriginal.BackColor = SystemColors.WindowFrame;
|
||||
|
||||
textBoxListViewText.Enabled = true;
|
||||
textBoxListViewTextOriginal.Enabled = true;
|
||||
timeUpDownStartTime.Enabled = true;
|
||||
numericUpDownDuration.Enabled = true;
|
||||
buttonPrevious.Enabled = true;
|
||||
buttonNext.Enabled = true;
|
||||
buttonUnBreak.Enabled = true;
|
||||
buttonAutoBreak.Enabled = true;
|
||||
labelText.Enabled = true;
|
||||
labelStartTime.Enabled = true;
|
||||
labelDuration.Enabled = true;
|
||||
if (Configuration.Settings.General.UseDarkTheme)
|
||||
{
|
||||
var foreColor = Configuration.Settings.General.DarkThemeForeColor;
|
||||
labelText.ForeColor = foreColor;
|
||||
labelStartTime.ForeColor = foreColor;
|
||||
labelDuration.ForeColor = foreColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9264,7 +9322,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
ResetTextInfoIfEmpty();
|
||||
EnableOrDisableEditControls();
|
||||
SetListViewStateImages();
|
||||
}
|
||||
|
||||
@ -12183,6 +12241,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
textBoxListViewText.Enabled = true;
|
||||
textBoxListViewText.BackColor = textBoxListViewText.Focused ? SystemColors.Highlight : SystemColors.WindowFrame;
|
||||
EnableOrDisableEditControls();
|
||||
}
|
||||
|
||||
StartUpdateListSyntaxColoring();
|
||||
@ -23427,6 +23486,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_timerSlow.Start();
|
||||
}
|
||||
|
||||
private void GroupBoxEdit_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!textBoxListViewText.Enabled)
|
||||
{
|
||||
InsertLineToolStripMenuItemClick(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBoxListViewText_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!textBoxListViewText.Enabled)
|
||||
@ -33111,5 +33178,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.SelectIndexAndEnsureVisibleFaster(idx);
|
||||
}
|
||||
}
|
||||
|
||||
private void Main_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.X > 72 && e.X <= (122 + textBoxListViewText.Height))
|
||||
{
|
||||
if (!textBoxListViewText.Enabled)
|
||||
{
|
||||
InsertLineToolStripMenuItemClick(null, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -791,7 +791,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAeQBLAHkASwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAARwBLQEcAS0BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
@ -404,7 +404,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
|
||||
}
|
||||
}
|
||||
|
||||
private string[] LoadWordSplitList(string threeLetterIsoLanguageName, NameList nameList)
|
||||
private static string[] LoadWordSplitList(string threeLetterIsoLanguageName, NameList nameList)
|
||||
{
|
||||
var fileName = $"{Configuration.DictionariesDirectory}{threeLetterIsoLanguageName}_WordSplitList.txt";
|
||||
if (!File.Exists(fileName))
|
||||
|
Loading…
Reference in New Issue
Block a user