Enable custom color for waveform cursor

This commit is contained in:
Nikolaj Olsson 2020-05-04 15:25:38 +02:00
parent 8ac87e2a5c
commit 3816a75442
9 changed files with 88 additions and 39 deletions

View File

@ -1914,6 +1914,7 @@ can edit in same subtitle file (collaboration)</Information>
<WaveformColor>Color</WaveformColor>
<WaveformSelectedColor>Selected color</WaveformSelectedColor>
<WaveformBackgroundColor>Back color</WaveformBackgroundColor>
<WaveformCursorColor>Cursor color</WaveformCursorColor>
<WaveformTextColor>Text color</WaveformTextColor>
<WaveformTextFontSize>Text font size</WaveformTextFontSize>
<WaveformAndSpectrogramsFolderEmpty>Empty 'Spectrograms' and 'Waveforms' folders</WaveformAndSpectrogramsFolderEmpty>

View File

@ -2211,6 +2211,7 @@ can edit in same subtitle file (collaboration)",
WaveformSelectedColor = "Selected color",
WaveformBackgroundColor = "Back color",
WaveformTextColor = "Text color",
WaveformCursorColor = "Cursor color",
WaveformTextFontSize = "Text font size",
WaveformAndSpectrogramsFolderEmpty = "Empty 'Spectrograms' and 'Waveforms' folders",
WaveformAndSpectrogramsFolderInfo = "'Waveforms' and 'Spectrograms' folders contain {0} files ({1:0.00} MB)",

View File

@ -5164,6 +5164,9 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/WaveformBackgroundColor":
language.Settings.WaveformBackgroundColor = reader.Value;
break;
case "Settings/WaveformCursorColor":
language.Settings.WaveformCursorColor = reader.Value;
break;
case "Settings/WaveformTextColor":
language.Settings.WaveformTextColor = reader.Value;
break;

View File

@ -2079,6 +2079,7 @@
public string WaveformColor { get; set; }
public string WaveformSelectedColor { get; set; }
public string WaveformBackgroundColor { get; set; }
public string WaveformCursorColor { get; set; }
public string WaveformTextColor { get; set; }
public string WaveformTextFontSize { get; set; }
public string WaveformAndSpectrogramsFolderEmpty { get; set; }

View File

@ -1309,6 +1309,7 @@ $HorzAlign = Center
public Color WaveformSelectedColor { get; set; }
public Color WaveformBackgroundColor { get; set; }
public Color WaveformTextColor { get; set; }
public Color WaveformCursorColor { get; set; }
public int WaveformTextSize { get; set; }
public bool WaveformTextBold { get; set; }
public string WaveformDoubleClickOnNonParagraphAction { get; set; }
@ -1339,6 +1340,7 @@ $HorzAlign = Center
WaveformSelectedColor = Color.FromArgb(255, 230, 0, 0);
WaveformBackgroundColor = Color.Black;
WaveformTextColor = Color.Gray;
WaveformCursorColor = Color.Turquoise;
WaveformTextSize = 9;
WaveformTextBold = true;
WaveformDoubleClickOnNonParagraphAction = "PlayPause";
@ -4932,6 +4934,12 @@ $HorzAlign = Center
settings.VideoControls.WaveformTextColor = Color.FromArgb(int.Parse(subNode.InnerText, CultureInfo.InvariantCulture));
}
subNode = node.SelectSingleNode("WaveformCursorColor");
if (subNode != null)
{
settings.VideoControls.WaveformCursorColor = Color.FromArgb(int.Parse(subNode.InnerText, CultureInfo.InvariantCulture));
}
subNode = node.SelectSingleNode("WaveformTextSize");
if (subNode != null)
{
@ -7265,6 +7273,7 @@ $HorzAlign = Center
textWriter.WriteElementString("WaveformSelectedColor", settings.VideoControls.WaveformSelectedColor.ToArgb().ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("WaveformBackgroundColor", settings.VideoControls.WaveformBackgroundColor.ToArgb().ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("WaveformTextColor", settings.VideoControls.WaveformTextColor.ToArgb().ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("WaveformCursorColor", settings.VideoControls.WaveformCursorColor.ToArgb().ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("WaveformTextSize", settings.VideoControls.WaveformTextSize.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("WaveformTextBold", settings.VideoControls.WaveformTextBold.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("WaveformDoubleClickOnNonParagraphAction", settings.VideoControls.WaveformDoubleClickOnNonParagraphAction);

View File

@ -263,6 +263,7 @@ namespace Nikse.SubtitleEdit.Controls
public Color SelectedColor { get; set; }
public Color ParagraphColor { get; set; }
public Color TextColor { get; set; }
public Color CursorColor { get; set; }
public float TextSize { get; set; }
public bool TextBold { get; set; }
public Color GridColor { get; set; }
@ -595,7 +596,7 @@ namespace Nikse.SubtitleEdit.Controls
graphics.DrawLine(p, pos, 0, pos, Height);
}
using (var p = new Pen(Color.Turquoise, 2) { DashStyle = DashStyle.Dash })
using (var p = new Pen(CursorColor, 2) { DashStyle = DashStyle.Dash })
{
graphics.DrawLine(p, pos, 0, pos, Height);
}
@ -643,7 +644,7 @@ namespace Nikse.SubtitleEdit.Controls
// current video position
if (_currentVideoPositionSeconds > 0 && !currentPosDone && currentPositionPos > 0 && currentPositionPos < Width)
{
using (var p = new Pen(Color.Turquoise))
using (var p = new Pen(CursorColor))
{
graphics.DrawLine(p, currentPositionPos, 0, currentPositionPos, Height);
}
@ -664,7 +665,7 @@ namespace Nikse.SubtitleEdit.Controls
if (currentRegionWidth > 40)
{
using (var brush = new SolidBrush(Color.Turquoise))
using (var brush = new SolidBrush(CursorColor))
{
graphics.DrawString($"{(double)currentRegionWidth / _wavePeaks.SampleRate / _zoomFactor:0.###} {Configuration.Settings.Language.Waveform.Seconds}", Font, brush, new PointF(currentRegionLeft + 3, Height - 32));
}

View File

@ -510,17 +510,7 @@ namespace Nikse.SubtitleEdit.Forms
audioVisualizer.InsertAtVideoPosition += audioVisualizer_InsertAtVideoPosition;
audioVisualizer.PasteAtVideoPosition += audioVisualizer_PasteAtVideoPosition;
audioVisualizer.KeyDown += AudioVisualizer_KeyDown;
audioVisualizer.ShowGridLines = Configuration.Settings.VideoControls.WaveformDrawGrid;
audioVisualizer.GridColor = Configuration.Settings.VideoControls.WaveformGridColor;
audioVisualizer.SelectedColor = Configuration.Settings.VideoControls.WaveformSelectedColor;
audioVisualizer.Color = Configuration.Settings.VideoControls.WaveformColor;
audioVisualizer.BackgroundColor = Configuration.Settings.VideoControls.WaveformBackgroundColor;
audioVisualizer.TextColor = Configuration.Settings.VideoControls.WaveformTextColor;
audioVisualizer.TextSize = Configuration.Settings.VideoControls.WaveformTextSize;
audioVisualizer.TextBold = Configuration.Settings.VideoControls.WaveformTextBold;
audioVisualizer.MouseWheelScrollUpIsForward = Configuration.Settings.VideoControls.WaveformMouseWheelScrollUpIsForward;
audioVisualizer.AllowOverlap = Configuration.Settings.VideoControls.WaveformAllowOverlap;
audioVisualizer.ClosenessForBorderSelection = Configuration.Settings.VideoControls.WaveformBorderHitMs;
SetAudioVisualizerSettings();
if (Configuration.Settings.General.WaveformUpdateIntervalMs > 0 && Configuration.Settings.General.WaveformUpdateIntervalMs < 200)
{
timerWaveform.Interval = Configuration.Settings.General.WaveformUpdateIntervalMs;
@ -4443,17 +4433,7 @@ namespace Nikse.SubtitleEdit.Forms
buttonCustomUrl2.Text = Configuration.Settings.VideoControls.CustomSearchText2;
buttonCustomUrl2.Visible = Configuration.Settings.VideoControls.CustomSearchUrl2.Length > 1;
audioVisualizer.ShowGridLines = Configuration.Settings.VideoControls.WaveformDrawGrid;
audioVisualizer.GridColor = Configuration.Settings.VideoControls.WaveformGridColor;
audioVisualizer.SelectedColor = Configuration.Settings.VideoControls.WaveformSelectedColor;
audioVisualizer.Color = Configuration.Settings.VideoControls.WaveformColor;
audioVisualizer.BackgroundColor = Configuration.Settings.VideoControls.WaveformBackgroundColor;
audioVisualizer.TextColor = Configuration.Settings.VideoControls.WaveformTextColor;
audioVisualizer.TextSize = Configuration.Settings.VideoControls.WaveformTextSize;
audioVisualizer.TextBold = Configuration.Settings.VideoControls.WaveformTextBold;
audioVisualizer.MouseWheelScrollUpIsForward = Configuration.Settings.VideoControls.WaveformMouseWheelScrollUpIsForward;
audioVisualizer.AllowOverlap = Configuration.Settings.VideoControls.WaveformAllowOverlap;
audioVisualizer.ClosenessForBorderSelection = Configuration.Settings.VideoControls.WaveformBorderHitMs;
SetAudioVisualizerSettings();
string newSyntaxColoring = Configuration.Settings.Tools.ListViewSyntaxColorDurationSmall.ToString() +
Configuration.Settings.Tools.ListViewSyntaxColorDurationBig +
@ -4623,6 +4603,22 @@ namespace Nikse.SubtitleEdit.Forms
ShowSourceLineNumber();
}
private void SetAudioVisualizerSettings()
{
audioVisualizer.ShowGridLines = Configuration.Settings.VideoControls.WaveformDrawGrid;
audioVisualizer.GridColor = Configuration.Settings.VideoControls.WaveformGridColor;
audioVisualizer.SelectedColor = Configuration.Settings.VideoControls.WaveformSelectedColor;
audioVisualizer.Color = Configuration.Settings.VideoControls.WaveformColor;
audioVisualizer.BackgroundColor = Configuration.Settings.VideoControls.WaveformBackgroundColor;
audioVisualizer.TextColor = Configuration.Settings.VideoControls.WaveformTextColor;
audioVisualizer.CursorColor = Configuration.Settings.VideoControls.WaveformCursorColor;
audioVisualizer.TextSize = Configuration.Settings.VideoControls.WaveformTextSize;
audioVisualizer.TextBold = Configuration.Settings.VideoControls.WaveformTextBold;
audioVisualizer.MouseWheelScrollUpIsForward = Configuration.Settings.VideoControls.WaveformMouseWheelScrollUpIsForward;
audioVisualizer.AllowOverlap = Configuration.Settings.VideoControls.WaveformAllowOverlap;
audioVisualizer.ClosenessForBorderSelection = Configuration.Settings.VideoControls.WaveformBorderHitMs;
}
private void CheckAndGetNewlyDownloadedMpvDlls()
{
if (_videoFileName == null || Configuration.Settings.General.VideoPlayer != "MPV" || mediaPlayer.VideoPlayer == null)

View File

@ -382,6 +382,8 @@
this.openFileDialogFFmpeg = new System.Windows.Forms.OpenFileDialog();
this.buttonReset = new System.Windows.Forms.Button();
this.toolTipContinuationPreview = new System.Windows.Forms.ToolTip(this.components);
this.panelWaveformCursorColor = new System.Windows.Forms.Panel();
this.buttonWaveformCursorColor = new System.Windows.Forms.Button();
this.tabControlSettings.SuspendLayout();
this.tabPageGeneral.SuspendLayout();
this.groupBoxMiscellaneous.SuspendLayout();
@ -2293,7 +2295,7 @@
this.groupBoxFfmpeg.Controls.Add(this.textBoxFFmpegPath);
this.groupBoxFfmpeg.Controls.Add(this.labelFFmpegPath);
this.groupBoxFfmpeg.Controls.Add(this.checkBoxUseFFmpeg);
this.groupBoxFfmpeg.Location = new System.Drawing.Point(406, 266);
this.groupBoxFfmpeg.Location = new System.Drawing.Point(406, 299);
this.groupBoxFfmpeg.Name = "groupBoxFfmpeg";
this.groupBoxFfmpeg.Size = new System.Drawing.Size(419, 118);
this.groupBoxFfmpeg.TabIndex = 2;
@ -2354,7 +2356,7 @@
this.groupBoxSpectrogram.Controls.Add(this.labelSpectrogramAppearance);
this.groupBoxSpectrogram.Controls.Add(this.comboBoxSpectrogramAppearance);
this.groupBoxSpectrogram.Controls.Add(this.checkBoxGenerateSpectrogram);
this.groupBoxSpectrogram.Location = new System.Drawing.Point(6, 266);
this.groupBoxSpectrogram.Location = new System.Drawing.Point(6, 299);
this.groupBoxSpectrogram.Name = "groupBoxSpectrogram";
this.groupBoxSpectrogram.Size = new System.Drawing.Size(394, 118);
this.groupBoxSpectrogram.TabIndex = 1;
@ -2398,9 +2400,9 @@
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.buttonWaveformsFolderEmpty);
this.groupBox1.Controls.Add(this.labelWaveformsFolderInfo);
this.groupBox1.Location = new System.Drawing.Point(6, 390);
this.groupBox1.Location = new System.Drawing.Point(10, 423);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(819, 110);
this.groupBox1.Size = new System.Drawing.Size(819, 80);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
//
@ -2427,6 +2429,8 @@
//
this.groupBoxWaveformAppearence.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxWaveformAppearence.Controls.Add(this.panelWaveformCursorColor);
this.groupBoxWaveformAppearence.Controls.Add(this.buttonWaveformCursorColor);
this.groupBoxWaveformAppearence.Controls.Add(this.checkBoxWaveformSnapToSceneChanges);
this.groupBoxWaveformAppearence.Controls.Add(this.checkBoxWaveformSingleClickSelect);
this.groupBoxWaveformAppearence.Controls.Add(this.checkBoxWaveformShowWpm);
@ -2455,7 +2459,7 @@
this.groupBoxWaveformAppearence.Controls.Add(this.checkBoxWaveformShowGrid);
this.groupBoxWaveformAppearence.Location = new System.Drawing.Point(6, 6);
this.groupBoxWaveformAppearence.Name = "groupBoxWaveformAppearence";
this.groupBoxWaveformAppearence.Size = new System.Drawing.Size(819, 254);
this.groupBoxWaveformAppearence.Size = new System.Drawing.Size(819, 287);
this.groupBoxWaveformAppearence.TabIndex = 0;
this.groupBoxWaveformAppearence.TabStop = false;
this.groupBoxWaveformAppearence.Text = "Waveform appearance";
@ -2483,20 +2487,20 @@
// checkBoxWaveformShowWpm
//
this.checkBoxWaveformShowWpm.AutoSize = true;
this.checkBoxWaveformShowWpm.Location = new System.Drawing.Point(16, 218);
this.checkBoxWaveformShowWpm.Location = new System.Drawing.Point(16, 248);
this.checkBoxWaveformShowWpm.Name = "checkBoxWaveformShowWpm";
this.checkBoxWaveformShowWpm.Size = new System.Drawing.Size(104, 17);
this.checkBoxWaveformShowWpm.TabIndex = 7;
this.checkBoxWaveformShowWpm.TabIndex = 8;
this.checkBoxWaveformShowWpm.Text = "Show words/min";
this.checkBoxWaveformShowWpm.UseVisualStyleBackColor = true;
//
// checkBoxWaveformShowCps
//
this.checkBoxWaveformShowCps.AutoSize = true;
this.checkBoxWaveformShowCps.Location = new System.Drawing.Point(16, 195);
this.checkBoxWaveformShowCps.Location = new System.Drawing.Point(16, 225);
this.checkBoxWaveformShowCps.Name = "checkBoxWaveformShowCps";
this.checkBoxWaveformShowCps.Size = new System.Drawing.Size(96, 17);
this.checkBoxWaveformShowCps.TabIndex = 6;
this.checkBoxWaveformShowCps.TabIndex = 7;
this.checkBoxWaveformShowCps.Text = "Show char/sec";
this.checkBoxWaveformShowCps.UseVisualStyleBackColor = true;
//
@ -2651,7 +2655,7 @@
// panelWaveformGridColor
//
this.panelWaveformGridColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelWaveformGridColor.Location = new System.Drawing.Point(138, 135);
this.panelWaveformGridColor.Location = new System.Drawing.Point(138, 163);
this.panelWaveformGridColor.Name = "panelWaveformGridColor";
this.panelWaveformGridColor.Size = new System.Drawing.Size(21, 20);
this.panelWaveformGridColor.TabIndex = 9;
@ -2659,10 +2663,10 @@
//
// buttonWaveformGridColor
//
this.buttonWaveformGridColor.Location = new System.Drawing.Point(16, 135);
this.buttonWaveformGridColor.Location = new System.Drawing.Point(16, 162);
this.buttonWaveformGridColor.Name = "buttonWaveformGridColor";
this.buttonWaveformGridColor.Size = new System.Drawing.Size(112, 21);
this.buttonWaveformGridColor.TabIndex = 4;
this.buttonWaveformGridColor.TabIndex = 5;
this.buttonWaveformGridColor.Text = "Grid color";
this.buttonWaveformGridColor.UseVisualStyleBackColor = true;
this.buttonWaveformGridColor.Click += new System.EventHandler(this.buttonWaveformGridColor_Click);
@ -2727,10 +2731,10 @@
// checkBoxWaveformShowGrid
//
this.checkBoxWaveformShowGrid.AutoSize = true;
this.checkBoxWaveformShowGrid.Location = new System.Drawing.Point(16, 162);
this.checkBoxWaveformShowGrid.Location = new System.Drawing.Point(16, 192);
this.checkBoxWaveformShowGrid.Name = "checkBoxWaveformShowGrid";
this.checkBoxWaveformShowGrid.Size = new System.Drawing.Size(73, 17);
this.checkBoxWaveformShowGrid.TabIndex = 5;
this.checkBoxWaveformShowGrid.TabIndex = 6;
this.checkBoxWaveformShowGrid.Text = "Show grid";
this.checkBoxWaveformShowGrid.UseVisualStyleBackColor = true;
//
@ -4636,6 +4640,25 @@
this.toolTipContinuationPreview.InitialDelay = 500;
this.toolTipContinuationPreview.ReshowDelay = 100;
//
// panelWaveformCursorColor
//
this.panelWaveformCursorColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelWaveformCursorColor.Location = new System.Drawing.Point(138, 136);
this.panelWaveformCursorColor.Name = "panelWaveformCursorColor";
this.panelWaveformCursorColor.Size = new System.Drawing.Size(21, 20);
this.panelWaveformCursorColor.TabIndex = 34;
this.panelWaveformCursorColor.Click += new System.EventHandler(this.buttonWaveformCursorColor_Click);
//
// buttonWaveformCursorColor
//
this.buttonWaveformCursorColor.Location = new System.Drawing.Point(16, 135);
this.buttonWaveformCursorColor.Name = "buttonWaveformCursorColor";
this.buttonWaveformCursorColor.Size = new System.Drawing.Size(112, 21);
this.buttonWaveformCursorColor.TabIndex = 4;
this.buttonWaveformCursorColor.Text = "Cursor color";
this.buttonWaveformCursorColor.UseVisualStyleBackColor = true;
this.buttonWaveformCursorColor.Click += new System.EventHandler(this.buttonWaveformCursorColor_Click);
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -5129,5 +5152,7 @@
private System.Windows.Forms.Button buttonFixContinuationStyleSettings;
private System.Windows.Forms.ComboBox comboBoxContinuationStyle;
private System.Windows.Forms.ToolTip toolTipContinuationPreview;
private System.Windows.Forms.Panel panelWaveformCursorColor;
private System.Windows.Forms.Button buttonWaveformCursorColor;
}
}

View File

@ -552,6 +552,7 @@ namespace Nikse.SubtitleEdit.Forms
buttonWaveformSelectedColor.Text = language.WaveformSelectedColor;
buttonWaveformTextColor.Text = language.WaveformTextColor;
buttonWaveformBackgroundColor.Text = language.WaveformBackgroundColor;
buttonWaveformCursorColor.Text = language.WaveformCursorColor;
groupBoxSpectrogram.Text = language.Spectrogram;
checkBoxGenerateSpectrogram.Text = language.GenerateSpectrogram;
labelSpectrogramAppearance.Text = language.SpectrogramAppearance;
@ -913,6 +914,7 @@ namespace Nikse.SubtitleEdit.Forms
panelWaveformColor.BackColor = Configuration.Settings.VideoControls.WaveformColor;
panelWaveformBackgroundColor.BackColor = Configuration.Settings.VideoControls.WaveformBackgroundColor;
panelWaveformTextColor.BackColor = Configuration.Settings.VideoControls.WaveformTextColor;
panelWaveformCursorColor.BackColor = Configuration.Settings.VideoControls.WaveformCursorColor;
checkBoxGenerateSpectrogram.Checked = Configuration.Settings.VideoControls.GenerateSpectrogram;
comboBoxSpectrogramAppearance.SelectedIndex = Configuration.Settings.VideoControls.SpectrogramAppearance == "OneColorGradient" ? 0 : 1;
comboBoxWaveformTextSize.Text = Configuration.Settings.VideoControls.WaveformTextSize.ToString(CultureInfo.InvariantCulture);
@ -1839,6 +1841,7 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.VideoControls.WaveformColor = panelWaveformColor.BackColor;
Configuration.Settings.VideoControls.WaveformBackgroundColor = panelWaveformBackgroundColor.BackColor;
Configuration.Settings.VideoControls.WaveformTextColor = panelWaveformTextColor.BackColor;
Configuration.Settings.VideoControls.WaveformCursorColor = panelWaveformCursorColor.BackColor ;
Configuration.Settings.VideoControls.GenerateSpectrogram = checkBoxGenerateSpectrogram.Checked;
Configuration.Settings.VideoControls.SpectrogramAppearance = comboBoxSpectrogramAppearance.SelectedIndex == 0 ? "OneColorGradient" : "Classic";
@ -2633,6 +2636,15 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void buttonWaveformCursorColor_Click(object sender, EventArgs e)
{
colorDialogSSAStyle.Color = panelWaveformCursorColor.BackColor;
if (colorDialogSSAStyle.ShowDialog() == DialogResult.OK)
{
panelWaveformCursorColor.BackColor = colorDialogSSAStyle.Color;
}
}
private void buttonWaveformsFolderEmpty_Click(object sender, EventArgs e)
{
string waveformsFolder = Configuration.WaveformsDirectory.TrimEnd(Path.DirectorySeparatorChar);