From 31ed11f60ad05e16048f86e48755ed6618c77536 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 1 Apr 2024 15:32:55 +0200 Subject: [PATCH] More on #8111 --- src/ui/Forms/Main.Designer.cs | 4 ++-- src/ui/Forms/Main.cs | 16 +++++++++++++++- src/ui/Forms/Main.resx | 4 ++-- src/ui/Forms/Translate/AutoTranslate.cs | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/ui/Forms/Main.Designer.cs b/src/ui/Forms/Main.Designer.cs index c23476dec..b30dc946b 100644 --- a/src/ui/Forms/Main.Designer.cs +++ b/src/ui/Forms/Main.Designer.cs @@ -2721,7 +2721,7 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemSelectedLines, this.toolStripMenuItemGoogleMicrosoftTranslateSelLine}); this.contextMenuStripListView.Name = "contextMenuStripListView"; - this.contextMenuStripListView.Size = new System.Drawing.Size(285, 848); + this.contextMenuStripListView.Size = new System.Drawing.Size(285, 826); 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); @@ -3233,7 +3233,7 @@ namespace Nikse.SubtitleEdit.Forms // genericTranslateToolStripMenuItem // this.genericTranslateToolStripMenuItem.Name = "genericTranslateToolStripMenuItem"; - this.genericTranslateToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.genericTranslateToolStripMenuItem.Size = new System.Drawing.Size(128, 22); this.genericTranslateToolStripMenuItem.Text = "translate..."; this.genericTranslateToolStripMenuItem.Click += new System.EventHandler(this.TranslateSelectedLinesToolStripMenuItemClick); // diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index 02345b8ea..1b16e0317 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -36405,7 +36405,7 @@ namespace Nikse.SubtitleEdit.Forms private void MakeAutoTranslate(bool onlySelectedLines) { - if (!IsSubtitleLoaded) + if (_subtitle != null && _subtitle.Paragraphs.Count == 0) { DisplaySubtitleNotLoadedMessage(); return; @@ -36464,6 +36464,20 @@ namespace Nikse.SubtitleEdit.Forms MakeHistoryForUndo(_language.BeforeGoogleTranslation); if (onlySelectedLines) { + if (!SubtitleListview1.IsOriginalTextColumnVisible) + { + SubtitleListview1.ShowOriginalTextColumn(_languageGeneral.OriginalText); + SubtitleListview1.AutoSizeAllColumns(this); + _subtitleOriginal = new Subtitle(_subtitle, false); + _subtitleOriginalFileName = _fileName; + _fileName = null; + + foreach (var p in _subtitle.Paragraphs) + { + p.Text = string.Empty; + } + } + // we only update selected lines foreach (int index in SubtitleListview1.SelectedIndices) { diff --git a/src/ui/Forms/Main.resx b/src/ui/Forms/Main.resx index 97859d158..9d9fef4b3 100644 --- a/src/ui/Forms/Main.resx +++ b/src/ui/Forms/Main.resx @@ -730,9 +730,9 @@ iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACJSURBVEhLYxjioPT6M4aKawVQHvEApAekFydIvP6bofx6 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACJSURBVEhLYxjioPT6M4aKawVQHvEApAekFydIuP6bofx6 A5RHPADpAenFCbAZXHk1ACi2nqHi6n44BokhA5INrrpiwFBx/T9Q7DxYHILPg8VAcjBAssEgNsgQdACx - DFXdqMFgMGowlDdqMCUG0yxLgwCowEEugEAFEsWFELGAoME0K+gHP2BgAAAFFhe2fSAzQAAAAABJRU5E + DFXdqMFgMGowlDdqMCUG0yxLgwCowEEugEAFEsWFELGAoME0K+gHP2BgAACKlxeWMO5vswAAAABJRU5E rkJggg== diff --git a/src/ui/Forms/Translate/AutoTranslate.cs b/src/ui/Forms/Translate/AutoTranslate.cs index c8097a930..46554fa2a 100644 --- a/src/ui/Forms/Translate/AutoTranslate.cs +++ b/src/ui/Forms/Translate/AutoTranslate.cs @@ -80,7 +80,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate Text = title; } - _subtitle = new Subtitle(subtitle); + _subtitle = new Subtitle(subtitle, false); _encoding = encoding; InitializeAutoTranslatorEngines();