From d9845b5dc440dd92810702f75f35161755baea56 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Fri, 18 Dec 2020 22:32:03 +0100 Subject: [PATCH] Work on dark theme default settings --- src/libse/Language.cs | 2 +- src/ui/Forms/Main.cs | 25 +++++++++++++++++++---- src/ui/Forms/Options/Settings.Designer.cs | 8 ++++++-- src/ui/Forms/Options/Settings.cs | 18 ++++++++++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/libse/Language.cs b/src/libse/Language.cs index 36b8db5f7..658b0ff69 100644 --- a/src/libse/Language.cs +++ b/src/libse/Language.cs @@ -2421,7 +2421,7 @@ can edit in same subtitle file (collaboration)", HtmlColor = "Html color", AssaColor = "ASSA color", DarkTheme ="Dark theme", - DarkThemeEnabled = "Dark theme enabled", + DarkThemeEnabled = "Use dark theme", ListViewAndTextBox = "List view and text box", UpdateShortcut = "Update", FoucsSetVideoPosition = "Focus set video position", diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index 9e0d159ff..2d9042216 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -4586,6 +4586,8 @@ namespace Nikse.SubtitleEdit.Forms var oldSubtitleTextBoxHtmlColor = Configuration.Settings.General.SubtitleTextBoxHtmlColor.ToArgb().ToString(); var oldSubtitleTextBoxAssaColor = Configuration.Settings.General.SubtitleTextBoxAssColor.ToArgb().ToString(); var oldUseDarkTheme = Configuration.Settings.General.UseDarkTheme; + var oldUseDarkForeColor = Configuration.Settings.General.DarkThemeForeColor; + var oldUseDarkBackColor = Configuration.Settings.General.DarkThemeBackColor; using (var settings = new Options.Settings()) { settings.Initialize(Icon, toolStripButtonFileNew.Image, toolStripButtonFileOpen.Image, toolStripButtonSave.Image, toolStripButtonSaveAs.Image, toolStripButtonFind.Image, @@ -4768,21 +4770,36 @@ namespace Nikse.SubtitleEdit.Forms RefreshTimeCodeMode(); } - if (oldUseDarkTheme != Configuration.Settings.General.UseDarkTheme) + if (oldUseDarkTheme != Configuration.Settings.General.UseDarkTheme || + oldUseDarkForeColor != Configuration.Settings.General.DarkThemeForeColor || + oldUseDarkBackColor != Configuration.Settings.General.DarkThemeBackColor) { if (Configuration.Settings.General.UseDarkTheme) { OnLoad(null); - Configuration.Settings.VideoControls.WaveformDrawGrid = false; + + if (oldUseDarkTheme != Configuration.Settings.General.UseDarkTheme) + { + // override colors one time + Configuration.Settings.VideoControls.WaveformDrawGrid = false; + Configuration.Settings.VideoControls.WaveformColor = Color.FromArgb(7, 65, 152); + Configuration.Settings.VideoControls.WaveformSelectedColor = Color.FromArgb(150, 0, 0); + + //TODO: list view colors... + } + textBoxListViewText.Initialize(Configuration.Settings.General.SubtitleTextBoxSyntaxColor); textBoxListViewTextAlternate.Initialize(Configuration.Settings.General.SubtitleTextBoxSyntaxColor); SubtitleListview1.BackColor = Configuration.Settings.General.SubtitleBackgroundColor; RefreshSelectedParagraph(); + SetAudioVisualizerSettings(); } else { Configuration.Settings.General.SubtitleBackgroundColor = new TextBox().BackColor; Configuration.Settings.General.SubtitleFontColor = DefaultForeColor; + Configuration.Settings.VideoControls.WaveformColor = Color.FromArgb(255, 160, 240, 30); + Configuration.Settings.VideoControls.WaveformSelectedColor = Color.FromArgb(255, 230, 0, 0); MessageBox.Show(Configuration.Settings.Language.Main.DarkThemeRestart); } } @@ -13961,7 +13978,7 @@ namespace Nikse.SubtitleEdit.Forms if (e.Modifiers == (Keys.Control | Keys.Shift) && e.KeyCode == Keys.ShiftKey) { return; - } + } var fc = FindFocusedControl(this); if (fc != null && e.Modifiers != Keys.Control && e.Modifiers != Keys.Alt && e.Modifiers != (Keys.Control | Keys.Shift) && e.Modifiers != (Keys.Control | Keys.Alt) && e.Modifiers != (Keys.Control | Keys.Shift | Keys.Alt)) @@ -13979,7 +13996,7 @@ namespace Nikse.SubtitleEdit.Forms { return; } - } + } if (e.KeyCode == Keys.Escape && !_cancelWordSpellCheck) { diff --git a/src/ui/Forms/Options/Settings.Designer.cs b/src/ui/Forms/Options/Settings.Designer.cs index 9d2e18ed6..6e206f1a0 100644 --- a/src/ui/Forms/Options/Settings.Designer.cs +++ b/src/ui/Forms/Options/Settings.Designer.cs @@ -4087,9 +4087,9 @@ this.checkBoxDarkThemeEnabled.AutoSize = true; this.checkBoxDarkThemeEnabled.Location = new System.Drawing.Point(16, 25); this.checkBoxDarkThemeEnabled.Name = "checkBoxDarkThemeEnabled"; - this.checkBoxDarkThemeEnabled.Size = new System.Drawing.Size(122, 17); + this.checkBoxDarkThemeEnabled.Size = new System.Drawing.Size(101, 17); this.checkBoxDarkThemeEnabled.TabIndex = 43; - this.checkBoxDarkThemeEnabled.Text = "Dark theme enabled"; + this.checkBoxDarkThemeEnabled.Text = "Use dark theme"; this.checkBoxDarkThemeEnabled.UseVisualStyleBackColor = true; // // panelDarkThemeBackColor @@ -4099,6 +4099,7 @@ this.panelDarkThemeBackColor.Name = "panelDarkThemeBackColor"; this.panelDarkThemeBackColor.Size = new System.Drawing.Size(21, 20); this.panelDarkThemeBackColor.TabIndex = 42; + this.panelDarkThemeBackColor.Click += new System.EventHandler(this.buttonDarkThemeBackColor_Click); // // buttonDarkThemeBackColor // @@ -4108,6 +4109,7 @@ this.buttonDarkThemeBackColor.TabIndex = 40; this.buttonDarkThemeBackColor.Text = "Back color"; this.buttonDarkThemeBackColor.UseVisualStyleBackColor = true; + this.buttonDarkThemeBackColor.Click += new System.EventHandler(this.buttonDarkThemeBackColor_Click); // // panelDarkThemeColor // @@ -4116,6 +4118,7 @@ this.panelDarkThemeColor.Name = "panelDarkThemeColor"; this.panelDarkThemeColor.Size = new System.Drawing.Size(21, 20); this.panelDarkThemeColor.TabIndex = 41; + this.panelDarkThemeColor.Click += new System.EventHandler(this.buttonDarkThemeColor_Click); // // buttonDarkThemeColor // @@ -4125,6 +4128,7 @@ this.buttonDarkThemeColor.TabIndex = 39; this.buttonDarkThemeColor.Text = "Color"; this.buttonDarkThemeColor.UseVisualStyleBackColor = true; + this.buttonDarkThemeColor.Click += new System.EventHandler(this.buttonDarkThemeColor_Click); // // labelFontNote // diff --git a/src/ui/Forms/Options/Settings.cs b/src/ui/Forms/Options/Settings.cs index 63c271b2c..331b991da 100644 --- a/src/ui/Forms/Options/Settings.cs +++ b/src/ui/Forms/Options/Settings.cs @@ -3510,5 +3510,23 @@ namespace Nikse.SubtitleEdit.Forms.Options { buttonTextBoxAssColor_Click(null, null); } + + private void buttonDarkThemeColor_Click(object sender, EventArgs e) + { + colorDialogSSAStyle.Color = panelDarkThemeColor.BackColor; + if (colorDialogSSAStyle.ShowDialog() == DialogResult.OK) + { + panelDarkThemeColor.BackColor = colorDialogSSAStyle.Color; + } + } + + private void buttonDarkThemeBackColor_Click(object sender, EventArgs e) + { + colorDialogSSAStyle.Color = panelDarkThemeBackColor.BackColor; + if (colorDialogSSAStyle.ShowDialog() == DialogResult.OK) + { + panelDarkThemeBackColor.BackColor = colorDialogSSAStyle.Color; + } + } } }