Add dialog style preview tooltip

This commit is contained in:
Martijn van Berkel (Flitskikker) 2022-06-22 11:44:34 +02:00
parent 00238ef0b7
commit c6250c6e26
7 changed files with 76 additions and 20 deletions

View File

@ -410,6 +410,24 @@ namespace Nikse.SubtitleEdit.Core.Common
return pre + s.TrimStart().TrimStart(GetDashChar(), GetAlternateDashChar()).TrimStart(); return pre + s.TrimStart().TrimStart(GetDashChar(), GetAlternateDashChar()).TrimStart();
} }
public static string GetDialogStylePreview(DialogType dialogType)
{
var line1 = "Lorem ipsum dolor sit amet.";
var line2 = "Donec eget turpis consequat.";
switch (dialogType)
{
case DialogType.DashBothLinesWithoutSpace:
return "-" + line1 + "\n" + "-" + line2;
case DialogType.DashSecondLineWithSpace:
return line1 + "\n" + "- " + line2;
case DialogType.DashSecondLineWithoutSpace:
return line1 + "\n" + "-" + line2;
default:
return "- " + line1 + "\n" + "- " + line2;
}
}
public static DialogType GetDialogStyleFromIndex(int index) public static DialogType GetDialogStyleFromIndex(int index)
{ {
switch (index) switch (index)

View File

@ -427,6 +427,7 @@
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.labelUpdateFileTypeAssociationsStatus = new System.Windows.Forms.Label(); this.labelUpdateFileTypeAssociationsStatus = new System.Windows.Forms.Label();
this.imageListFileTypeAssociations = new System.Windows.Forms.ImageList(this.components); this.imageListFileTypeAssociations = new System.Windows.Forms.ImageList(this.components);
this.toolTipDialogStylePreview = new System.Windows.Forms.ToolTip(this.components);
this.panelGeneral.SuspendLayout(); this.panelGeneral.SuspendLayout();
this.groupBoxMiscellaneous.SuspendLayout(); this.groupBoxMiscellaneous.SuspendLayout();
this.groupBoxGeneralRules.SuspendLayout(); this.groupBoxGeneralRules.SuspendLayout();
@ -2883,7 +2884,7 @@
this.checkBoxWaveformSnapToShotChanges.AutoSize = true; this.checkBoxWaveformSnapToShotChanges.AutoSize = true;
this.checkBoxWaveformSnapToShotChanges.Location = new System.Drawing.Point(262, 161); this.checkBoxWaveformSnapToShotChanges.Location = new System.Drawing.Point(262, 161);
this.checkBoxWaveformSnapToShotChanges.Name = "checkBoxWaveformSnapToShotChanges"; this.checkBoxWaveformSnapToShotChanges.Name = "checkBoxWaveformSnapToShotChanges";
this.checkBoxWaveformSnapToShotChanges.Size = new System.Drawing.Size(249, 17); this.checkBoxWaveformSnapToShotChanges.Size = new System.Drawing.Size(242, 17);
this.checkBoxWaveformSnapToShotChanges.TabIndex = 26; this.checkBoxWaveformSnapToShotChanges.TabIndex = 26;
this.checkBoxWaveformSnapToShotChanges.Text = "Snap to shot changes (hold Shift to override)"; this.checkBoxWaveformSnapToShotChanges.Text = "Snap to shot changes (hold Shift to override)";
this.checkBoxWaveformSnapToShotChanges.UseVisualStyleBackColor = true; this.checkBoxWaveformSnapToShotChanges.UseVisualStyleBackColor = true;
@ -5124,6 +5125,12 @@
this.imageListFileTypeAssociations.ImageSize = new System.Drawing.Size(32, 32); this.imageListFileTypeAssociations.ImageSize = new System.Drawing.Size(32, 32);
this.imageListFileTypeAssociations.TransparentColor = System.Drawing.Color.Transparent; this.imageListFileTypeAssociations.TransparentColor = System.Drawing.Color.Transparent;
// //
// toolTipDialogStylePreview
//
this.toolTipDialogStylePreview.AutoPopDelay = 60000;
this.toolTipDialogStylePreview.InitialDelay = 500;
this.toolTipDialogStylePreview.ReshowDelay = 100;
//
// Settings // Settings
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -5671,5 +5678,6 @@
private System.Windows.Forms.ComboBox comboBoxCpsLineLenCalc; private System.Windows.Forms.ComboBox comboBoxCpsLineLenCalc;
private System.Windows.Forms.Label labelCpsLineLenCalc; private System.Windows.Forms.Label labelCpsLineLenCalc;
private System.Windows.Forms.CheckBox checkBoxUseWordSplitList; private System.Windows.Forms.CheckBox checkBoxUseWordSplitList;
private System.Windows.Forms.ToolTip toolTipDialogStylePreview;
} }
} }

View File

@ -1151,19 +1151,24 @@ namespace Nikse.SubtitleEdit.Forms.Options
comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashSecondLineWithSpace); comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashSecondLineWithSpace);
comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashSecondLineWithoutSpace); comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashSecondLineWithoutSpace);
comboBoxDialogStyle.SelectedIndex = 0; comboBoxDialogStyle.SelectedIndex = 0;
toolTipDialogStylePreview.RemoveAll();
switch (dialogStyle) switch (dialogStyle)
{ {
case DialogType.DashBothLinesWithSpace: case DialogType.DashBothLinesWithSpace:
comboBoxDialogStyle.SelectedIndex = 0; comboBoxDialogStyle.SelectedIndex = 0;
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(DialogType.DashBothLinesWithSpace));
break; break;
case DialogType.DashBothLinesWithoutSpace: case DialogType.DashBothLinesWithoutSpace:
comboBoxDialogStyle.SelectedIndex = 1; comboBoxDialogStyle.SelectedIndex = 1;
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(DialogType.DashBothLinesWithoutSpace));
break; break;
case DialogType.DashSecondLineWithSpace: case DialogType.DashSecondLineWithSpace:
comboBoxDialogStyle.SelectedIndex = 2; comboBoxDialogStyle.SelectedIndex = 2;
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(DialogType.DashSecondLineWithSpace));
break; break;
case DialogType.DashSecondLineWithoutSpace: case DialogType.DashSecondLineWithoutSpace:
comboBoxDialogStyle.SelectedIndex = 3; comboBoxDialogStyle.SelectedIndex = 3;
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(DialogType.DashSecondLineWithoutSpace));
break; break;
} }
} }
@ -3534,6 +3539,9 @@ namespace Nikse.SubtitleEdit.Forms.Options
toolTipContinuationPreview.RemoveAll(); toolTipContinuationPreview.RemoveAll();
toolTipContinuationPreview.SetToolTip(comboBoxContinuationStyle, ContinuationUtilities.GetContinuationStylePreview(_rulesProfiles[idx].ContinuationStyle)); toolTipContinuationPreview.SetToolTip(comboBoxContinuationStyle, ContinuationUtilities.GetContinuationStylePreview(_rulesProfiles[idx].ContinuationStyle));
toolTipDialogStylePreview.RemoveAll();
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(_rulesProfiles[idx].DialogStyle));
} }
private void checkBoxToolsBreakByPixelWidth_CheckedChanged(object sender, EventArgs e) private void checkBoxToolsBreakByPixelWidth_CheckedChanged(object sender, EventArgs e)

View File

@ -138,4 +138,7 @@
<metadata name="imageListFileTypeAssociations.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="imageListFileTypeAssociations.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="toolTipDialogStylePreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1007, 37</value>
</metadata>
</root> </root>

View File

@ -33,6 +33,8 @@
this.labelName = new System.Windows.Forms.Label(); this.labelName = new System.Windows.Forms.Label();
this.textBoxName = new System.Windows.Forms.TextBox(); this.textBoxName = new System.Windows.Forms.TextBox();
this.groupBoxGeneralRules = new System.Windows.Forms.GroupBox(); this.groupBoxGeneralRules = new System.Windows.Forms.GroupBox();
this.comboBoxCpsLineLenCalc = new System.Windows.Forms.ComboBox();
this.labelCpsLineLenCalc = new System.Windows.Forms.Label();
this.comboBoxContinuationStyle = new System.Windows.Forms.ComboBox(); this.comboBoxContinuationStyle = new System.Windows.Forms.ComboBox();
this.labelContinuationStyle = new System.Windows.Forms.Label(); this.labelContinuationStyle = new System.Windows.Forms.Label();
this.labelDialogStyle = new System.Windows.Forms.Label(); this.labelDialogStyle = new System.Windows.Forms.Label();
@ -71,8 +73,7 @@
this.buttonOK = new System.Windows.Forms.Button(); this.buttonOK = new System.Windows.Forms.Button();
this.openFileDialogImport = new System.Windows.Forms.OpenFileDialog(); this.openFileDialogImport = new System.Windows.Forms.OpenFileDialog();
this.toolTipContinuationPreview = new System.Windows.Forms.ToolTip(this.components); this.toolTipContinuationPreview = new System.Windows.Forms.ToolTip(this.components);
this.comboBoxCpsLineLenCalc = new System.Windows.Forms.ComboBox(); this.toolTipDialogStylePreview = new System.Windows.Forms.ToolTip(this.components);
this.labelCpsLineLenCalc = new System.Windows.Forms.Label();
this.groupBoxStyles.SuspendLayout(); this.groupBoxStyles.SuspendLayout();
this.groupBoxGeneralRules.SuspendLayout(); this.groupBoxGeneralRules.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownOptimalCharsSec)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownOptimalCharsSec)).BeginInit();
@ -160,6 +161,25 @@
this.groupBoxGeneralRules.TabStop = false; this.groupBoxGeneralRules.TabStop = false;
this.groupBoxGeneralRules.Text = "Rules"; this.groupBoxGeneralRules.Text = "Rules";
// //
// comboBoxCpsLineLenCalc
//
this.comboBoxCpsLineLenCalc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxCpsLineLenCalc.DropDownWidth = 170;
this.comboBoxCpsLineLenCalc.FormattingEnabled = true;
this.comboBoxCpsLineLenCalc.Location = new System.Drawing.Point(132, 313);
this.comboBoxCpsLineLenCalc.Name = "comboBoxCpsLineLenCalc";
this.comboBoxCpsLineLenCalc.Size = new System.Drawing.Size(174, 21);
this.comboBoxCpsLineLenCalc.TabIndex = 197;
//
// labelCpsLineLenCalc
//
this.labelCpsLineLenCalc.AutoSize = true;
this.labelCpsLineLenCalc.Location = new System.Drawing.Point(4, 316);
this.labelCpsLineLenCalc.Name = "labelCpsLineLenCalc";
this.labelCpsLineLenCalc.Size = new System.Drawing.Size(102, 13);
this.labelCpsLineLenCalc.TabIndex = 196;
this.labelCpsLineLenCalc.Text = "Cps/line length style";
//
// comboBoxContinuationStyle // comboBoxContinuationStyle
// //
this.comboBoxContinuationStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxContinuationStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@ -627,24 +647,11 @@
this.toolTipContinuationPreview.InitialDelay = 500; this.toolTipContinuationPreview.InitialDelay = 500;
this.toolTipContinuationPreview.ReshowDelay = 100; this.toolTipContinuationPreview.ReshowDelay = 100;
// //
// comboBoxCpsLineLenCalc // toolTipDialogStylePreview
// //
this.comboBoxCpsLineLenCalc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.toolTipDialogStylePreview.AutoPopDelay = 60000;
this.comboBoxCpsLineLenCalc.DropDownWidth = 170; this.toolTipDialogStylePreview.InitialDelay = 500;
this.comboBoxCpsLineLenCalc.FormattingEnabled = true; this.toolTipDialogStylePreview.ReshowDelay = 100;
this.comboBoxCpsLineLenCalc.Location = new System.Drawing.Point(132, 313);
this.comboBoxCpsLineLenCalc.Name = "comboBoxCpsLineLenCalc";
this.comboBoxCpsLineLenCalc.Size = new System.Drawing.Size(174, 21);
this.comboBoxCpsLineLenCalc.TabIndex = 197;
//
// labelCpsLineLenCalc
//
this.labelCpsLineLenCalc.AutoSize = true;
this.labelCpsLineLenCalc.Location = new System.Drawing.Point(4, 316);
this.labelCpsLineLenCalc.Name = "labelCpsLineLenCalc";
this.labelCpsLineLenCalc.Size = new System.Drawing.Size(102, 13);
this.labelCpsLineLenCalc.TabIndex = 196;
this.labelCpsLineLenCalc.Text = "Cps/line length style";
// //
// SettingsProfile // SettingsProfile
// //
@ -725,5 +732,6 @@
private System.Windows.Forms.ToolTip toolTipContinuationPreview; private System.Windows.Forms.ToolTip toolTipContinuationPreview;
private System.Windows.Forms.ComboBox comboBoxCpsLineLenCalc; private System.Windows.Forms.ComboBox comboBoxCpsLineLenCalc;
private System.Windows.Forms.Label labelCpsLineLenCalc; private System.Windows.Forms.Label labelCpsLineLenCalc;
private System.Windows.Forms.ToolTip toolTipDialogStylePreview;
} }
} }

View File

@ -229,6 +229,9 @@ namespace Nikse.SubtitleEdit.Forms.Options
toolTipContinuationPreview.RemoveAll(); toolTipContinuationPreview.RemoveAll();
toolTipContinuationPreview.SetToolTip(comboBoxContinuationStyle, ContinuationUtilities.GetContinuationStylePreview(RulesProfiles[idx].ContinuationStyle)); toolTipContinuationPreview.SetToolTip(comboBoxContinuationStyle, ContinuationUtilities.GetContinuationStylePreview(RulesProfiles[idx].ContinuationStyle));
toolTipDialogStylePreview.RemoveAll();
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(RulesProfiles[idx].DialogStyle));
} }
private void listViewProfiles_SelectedIndexChanged(object sender, EventArgs e) private void listViewProfiles_SelectedIndexChanged(object sender, EventArgs e)
@ -303,19 +306,24 @@ namespace Nikse.SubtitleEdit.Forms.Options
comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashBothLinesWithoutSpace); comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashBothLinesWithoutSpace);
comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashSecondLineWithSpace); comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashSecondLineWithSpace);
comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashSecondLineWithoutSpace); comboBoxDialogStyle.Items.Add(LanguageSettings.Current.Settings.DialogStyleDashSecondLineWithoutSpace);
toolTipDialogStylePreview.RemoveAll();
switch (RulesProfiles[idx].DialogStyle) switch (RulesProfiles[idx].DialogStyle)
{ {
case DialogType.DashBothLinesWithSpace: case DialogType.DashBothLinesWithSpace:
comboBoxDialogStyle.SelectedIndex = 0; comboBoxDialogStyle.SelectedIndex = 0;
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(DialogType.DashBothLinesWithSpace));
break; break;
case DialogType.DashBothLinesWithoutSpace: case DialogType.DashBothLinesWithoutSpace:
comboBoxDialogStyle.SelectedIndex = 1; comboBoxDialogStyle.SelectedIndex = 1;
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(DialogType.DashBothLinesWithoutSpace));
break; break;
case DialogType.DashSecondLineWithSpace: case DialogType.DashSecondLineWithSpace:
comboBoxDialogStyle.SelectedIndex = 2; comboBoxDialogStyle.SelectedIndex = 2;
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(DialogType.DashSecondLineWithSpace));
break; break;
case DialogType.DashSecondLineWithoutSpace: case DialogType.DashSecondLineWithoutSpace:
comboBoxDialogStyle.SelectedIndex = 3; comboBoxDialogStyle.SelectedIndex = 3;
toolTipDialogStylePreview.SetToolTip(comboBoxDialogStyle, DialogSplitMerge.GetDialogStylePreview(DialogType.DashSecondLineWithoutSpace));
break; break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();

View File

@ -123,4 +123,7 @@
<metadata name="toolTipContinuationPreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTipContinuationPreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 14</value> <value>262, 14</value>
</metadata> </metadata>
<metadata name="toolTipDialogStylePreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>488, 14</value>
</metadata>
</root> </root>