Enable rich text box syntax coloring color picker

This commit is contained in:
Nikolaj Olsson 2020-11-14 19:28:01 +01:00
parent a358a0bdee
commit de116602fe
6 changed files with 111 additions and 52 deletions

View File

@ -2106,6 +2106,9 @@ can edit in same subtitle file (collaboration)</Information>
<ListViewAndTextBox>List view and text box</ListViewAndTextBox>
<ListView>List view</ListView>
<TextBox>Text box</TextBox>
<UseSyntaxColoring>Use syntax coloring</UseSyntaxColoring>
<HtmlColor>Html color</HtmlColor>
<AssaColor>ASSA color</AssaColor>
<UpdateShortcut>Update</UpdateShortcut>
<FoucsSetVideoPosition>Focus set video position</FoucsSetVideoPosition>
<ToggleDockUndockOfVideoControls>Toggle dock/undock of video controls</ToggleDockUndockOfVideoControls>

View File

@ -2411,6 +2411,9 @@ can edit in same subtitle file (collaboration)",
Key = "Key",
ListView = "List view",
TextBox = "Text box",
UseSyntaxColoring = "Use syntax coloring",
HtmlColor = "Html color",
AssaColor = "ASSA color",
ListViewAndTextBox = "List view and text box",
UpdateShortcut = "Update",
FoucsSetVideoPosition = "Focus set video position",

View File

@ -5740,6 +5740,15 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/TextBox":
language.Settings.TextBox = reader.Value;
break;
case "Settings/UseSyntaxColoring":
language.Settings.UseSyntaxColoring = reader.Value;
break;
case "Settings/HtmlColor":
language.Settings.HtmlColor = reader.Value;
break;
case "Settings/AssaColor":
language.Settings.AssaColor = reader.Value;
break;
case "Settings/UpdateShortcut":
language.Settings.UpdateShortcut = reader.Value;
break;

View File

@ -2272,6 +2272,9 @@
public string ListViewAndTextBox { get; set; }
public string ListView { get; set; }
public string TextBox { get; set; }
public string UseSyntaxColoring { get; set; }
public string HtmlColor { get; set; }
public string AssaColor { get; set; }
public string UpdateShortcut { get; set; }
public string FoucsSetVideoPosition { get; set; }
public string ToggleDockUndockOfVideoControls { get; set; }

View File

@ -329,6 +329,11 @@
this.groupBoxFont = new System.Windows.Forms.GroupBox();
this.labelFontNote = new System.Windows.Forms.Label();
this.groupBoxFontTextBox = new System.Windows.Forms.GroupBox();
this.panelTextBoxAssColor = new System.Windows.Forms.Panel();
this.buttonTextBoxAssColor = new System.Windows.Forms.Button();
this.panelTextBoxHtmlColor = new System.Windows.Forms.Panel();
this.buttonTextBoxHtmlColor = new System.Windows.Forms.Button();
this.checkBoxSubtitleTextBoxSyntaxColor = new System.Windows.Forms.CheckBox();
this.labelSubtitleFontSize = new System.Windows.Forms.Label();
this.comboBoxSubtitleFontSize = new System.Windows.Forms.ComboBox();
this.checkBoxSubtitleFontBold = new System.Windows.Forms.CheckBox();
@ -390,11 +395,6 @@
this.buttonReset = new System.Windows.Forms.Button();
this.toolTipContinuationPreview = new System.Windows.Forms.ToolTip(this.components);
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.checkBoxSubtitleTextBoxSyntaxColor = new System.Windows.Forms.CheckBox();
this.panelTextBoxAssColor = new System.Windows.Forms.Panel();
this.buttonTextBoxAssColor = new System.Windows.Forms.Button();
this.panelTextBoxHtmlColor = new System.Windows.Forms.Panel();
this.buttonTextBoxHtmlColor = new System.Windows.Forms.Button();
this.tabControlSettings.SuspendLayout();
this.tabPageGeneral.SuspendLayout();
this.groupBoxMiscellaneous.SuspendLayout();
@ -4044,7 +4044,7 @@
// labelFontNote
//
this.labelFontNote.AutoSize = true;
this.labelFontNote.Location = new System.Drawing.Point(11, 410);
this.labelFontNote.Location = new System.Drawing.Point(11, 352);
this.labelFontNote.Name = "labelFontNote";
this.labelFontNote.Size = new System.Drawing.Size(278, 13);
this.labelFontNote.TabIndex = 41;
@ -4065,11 +4065,60 @@
this.groupBoxFontTextBox.Controls.Add(this.checkBoxSubtitleCenter);
this.groupBoxFontTextBox.Location = new System.Drawing.Point(14, 228);
this.groupBoxFontTextBox.Name = "groupBoxFontTextBox";
this.groupBoxFontTextBox.Size = new System.Drawing.Size(806, 161);
this.groupBoxFontTextBox.Size = new System.Drawing.Size(806, 116);
this.groupBoxFontTextBox.TabIndex = 40;
this.groupBoxFontTextBox.TabStop = false;
this.groupBoxFontTextBox.Text = "Text box";
//
// panelTextBoxAssColor
//
this.panelTextBoxAssColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTextBoxAssColor.Location = new System.Drawing.Point(520, 73);
this.panelTextBoxAssColor.Name = "panelTextBoxAssColor";
this.panelTextBoxAssColor.Size = new System.Drawing.Size(21, 20);
this.panelTextBoxAssColor.TabIndex = 38;
this.panelTextBoxAssColor.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panelTextBoxAssColor_MouseClick);
//
// buttonTextBoxAssColor
//
this.buttonTextBoxAssColor.Location = new System.Drawing.Point(396, 72);
this.buttonTextBoxAssColor.Name = "buttonTextBoxAssColor";
this.buttonTextBoxAssColor.Size = new System.Drawing.Size(112, 23);
this.buttonTextBoxAssColor.TabIndex = 36;
this.buttonTextBoxAssColor.Text = "ASSA color";
this.buttonTextBoxAssColor.UseVisualStyleBackColor = true;
this.buttonTextBoxAssColor.Click += new System.EventHandler(this.buttonTextBoxAssColor_Click);
//
// panelTextBoxHtmlColor
//
this.panelTextBoxHtmlColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTextBoxHtmlColor.Location = new System.Drawing.Point(520, 44);
this.panelTextBoxHtmlColor.Name = "panelTextBoxHtmlColor";
this.panelTextBoxHtmlColor.Size = new System.Drawing.Size(21, 20);
this.panelTextBoxHtmlColor.TabIndex = 37;
this.panelTextBoxHtmlColor.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panelTextBoxHtmlColor_MouseClick);
//
// buttonTextBoxHtmlColor
//
this.buttonTextBoxHtmlColor.Location = new System.Drawing.Point(396, 43);
this.buttonTextBoxHtmlColor.Name = "buttonTextBoxHtmlColor";
this.buttonTextBoxHtmlColor.Size = new System.Drawing.Size(112, 23);
this.buttonTextBoxHtmlColor.TabIndex = 35;
this.buttonTextBoxHtmlColor.Text = "Html color";
this.buttonTextBoxHtmlColor.UseVisualStyleBackColor = true;
this.buttonTextBoxHtmlColor.Click += new System.EventHandler(this.buttonTextBoxHtmlColor_Click);
//
// checkBoxSubtitleTextBoxSyntaxColor
//
this.checkBoxSubtitleTextBoxSyntaxColor.AutoSize = true;
this.checkBoxSubtitleTextBoxSyntaxColor.Location = new System.Drawing.Point(396, 20);
this.checkBoxSubtitleTextBoxSyntaxColor.Name = "checkBoxSubtitleTextBoxSyntaxColor";
this.checkBoxSubtitleTextBoxSyntaxColor.Size = new System.Drawing.Size(120, 17);
this.checkBoxSubtitleTextBoxSyntaxColor.TabIndex = 34;
this.checkBoxSubtitleTextBoxSyntaxColor.Text = "Use syntax coloring";
this.checkBoxSubtitleTextBoxSyntaxColor.UseVisualStyleBackColor = true;
this.checkBoxSubtitleTextBoxSyntaxColor.CheckedChanged += new System.EventHandler(this.checkBoxSubtitleTextBoxSyntaxColor_CheckedChanged);
//
// labelSubtitleFontSize
//
this.labelSubtitleFontSize.AutoSize = true;
@ -4724,50 +4773,6 @@
this.toolTipContinuationPreview.InitialDelay = 500;
this.toolTipContinuationPreview.ReshowDelay = 100;
//
// checkBoxSubtitleTextBoxSyntaxColor
//
this.checkBoxSubtitleTextBoxSyntaxColor.AutoSize = true;
this.checkBoxSubtitleTextBoxSyntaxColor.Location = new System.Drawing.Point(396, 20);
this.checkBoxSubtitleTextBoxSyntaxColor.Name = "checkBoxSubtitleTextBoxSyntaxColor";
this.checkBoxSubtitleTextBoxSyntaxColor.Size = new System.Drawing.Size(120, 17);
this.checkBoxSubtitleTextBoxSyntaxColor.TabIndex = 34;
this.checkBoxSubtitleTextBoxSyntaxColor.Text = "Use syntax coloring";
this.checkBoxSubtitleTextBoxSyntaxColor.UseVisualStyleBackColor = true;
//
// panelTextBoxAssColor
//
this.panelTextBoxAssColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTextBoxAssColor.Location = new System.Drawing.Point(520, 73);
this.panelTextBoxAssColor.Name = "panelTextBoxAssColor";
this.panelTextBoxAssColor.Size = new System.Drawing.Size(21, 20);
this.panelTextBoxAssColor.TabIndex = 38;
//
// buttonTextBoxAssColor
//
this.buttonTextBoxAssColor.Location = new System.Drawing.Point(396, 72);
this.buttonTextBoxAssColor.Name = "buttonTextBoxAssColor";
this.buttonTextBoxAssColor.Size = new System.Drawing.Size(112, 23);
this.buttonTextBoxAssColor.TabIndex = 36;
this.buttonTextBoxAssColor.Text = "ASSA color";
this.buttonTextBoxAssColor.UseVisualStyleBackColor = true;
//
// panelTextBoxHtmlColor
//
this.panelTextBoxHtmlColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTextBoxHtmlColor.Location = new System.Drawing.Point(520, 44);
this.panelTextBoxHtmlColor.Name = "panelTextBoxHtmlColor";
this.panelTextBoxHtmlColor.Size = new System.Drawing.Size(21, 20);
this.panelTextBoxHtmlColor.TabIndex = 37;
//
// buttonTextBoxHtmlColor
//
this.buttonTextBoxHtmlColor.Location = new System.Drawing.Point(396, 43);
this.buttonTextBoxHtmlColor.Name = "buttonTextBoxHtmlColor";
this.buttonTextBoxHtmlColor.Size = new System.Drawing.Size(112, 23);
this.buttonTextBoxHtmlColor.TabIndex = 35;
this.buttonTextBoxHtmlColor.Text = "Html color";
this.buttonTextBoxHtmlColor.UseVisualStyleBackColor = true;
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -1971,7 +1971,7 @@ namespace Nikse.SubtitleEdit.Forms
{
font = new Font(Font, FontStyle.Regular);
}
var measureBmp = TextDesigner.MakeTextBitmapAssa(
Configuration.Settings.General.PreviewAssaText,
0,
@ -3448,5 +3448,41 @@ namespace Nikse.SubtitleEdit.Forms
_backgroundImageDark = !_backgroundImageDark;
GeneratePreviewReal();
}
private void buttonTextBoxHtmlColor_Click(object sender, EventArgs e)
{
colorDialogSSAStyle.Color = panelTextBoxHtmlColor.BackColor;
if (colorDialogSSAStyle.ShowDialog() == DialogResult.OK)
{
panelTextBoxHtmlColor.BackColor = colorDialogSSAStyle.Color;
}
}
private void buttonTextBoxAssColor_Click(object sender, EventArgs e)
{
colorDialogSSAStyle.Color = panelTextBoxAssColor.BackColor;
if (colorDialogSSAStyle.ShowDialog() == DialogResult.OK)
{
panelTextBoxAssColor.BackColor = colorDialogSSAStyle.Color;
}
}
private void checkBoxSubtitleTextBoxSyntaxColor_CheckedChanged(object sender, EventArgs e)
{
buttonTextBoxHtmlColor.Enabled = checkBoxSubtitleTextBoxSyntaxColor.Checked;
panelTextBoxHtmlColor.Enabled = checkBoxSubtitleTextBoxSyntaxColor.Checked;
buttonTextBoxAssColor.Enabled = checkBoxSubtitleTextBoxSyntaxColor.Checked;
panelTextBoxAssColor.Enabled = checkBoxSubtitleTextBoxSyntaxColor.Checked;
}
private void panelTextBoxHtmlColor_MouseClick(object sender, MouseEventArgs e)
{
buttonTextBoxHtmlColor_Click(null, null);
}
private void panelTextBoxAssColor_MouseClick(object sender, MouseEventArgs e)
{
buttonTextBoxAssColor_Click(null, null);
}
}
}