mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
parent
67c9565b29
commit
ae04ccae7a
@ -1281,7 +1281,7 @@ To use an API key go to "Options -> Settings -> Tools" to enter your Googl
|
||||
<WebVTTRemoveVoices>Remove voices</WebVTTRemoveVoices>
|
||||
<NewActor>New actor...</NewActor>
|
||||
<RemoveActors>Remove actors</RemoveActors>
|
||||
<EditBookmark>Edit bookmark</EditBookmark>
|
||||
<EditBookmark>Edit bookmark...</EditBookmark>
|
||||
<RemoveBookmark>Remove bookmark</RemoveBookmark>
|
||||
<GoToSourceView>Go to source view</GoToSourceView>
|
||||
<GoToListView>Go to list view</GoToListView>
|
||||
@ -1960,7 +1960,8 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<ToggleBookmarks>Toggle bookmarks</ToggleBookmarks>
|
||||
<ToggleBookmarksWithComment>Toggle bookmarks - add comment</ToggleBookmarksWithComment>
|
||||
<ClearBookmarks>Clear bookmarks</ClearBookmarks>
|
||||
<GoToBookmark>Go to bookmark</GoToBookmark>
|
||||
<ExportBookmarks>Export bookmarks...</ExportBookmarks>
|
||||
<GoToBookmark>Go to bookmark...</GoToBookmark>
|
||||
<GoToPreviousBookmark>Go to previous bookmark</GoToPreviousBookmark>
|
||||
<GoToNextBookmark>Go to next bookmark</GoToNextBookmark>
|
||||
<ChooseProfile>Choose profile</ChooseProfile>
|
||||
@ -1982,7 +1983,7 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<SubtitleLineMaximumLength>Single line max. length</SubtitleLineMaximumLength>
|
||||
<OptimalCharactersPerSecond>Optimal chars/sec</OptimalCharactersPerSecond>
|
||||
<MaximumCharactersPerSecond>Max. chars/sec</MaximumCharactersPerSecond>
|
||||
<MaximumWordssPerMinute>Max. words/min</MaximumWordssPerMinute>
|
||||
<MaximumWordsPerMinute>Max. words/min</MaximumWordsPerMinute>
|
||||
<AutoWrapWhileTyping>Auto-wrap while typing</AutoWrapWhileTyping>
|
||||
<DurationMinimumMilliseconds>Min. duration, milliseconds</DurationMinimumMilliseconds>
|
||||
<DurationMaximumMilliseconds>Max. duration, milliseconds</DurationMaximumMilliseconds>
|
||||
|
25
src/ui/Forms/BookmarksGoTo.Designer.cs
generated
25
src/ui/Forms/BookmarksGoTo.Designer.cs
generated
@ -34,6 +34,7 @@
|
||||
this.columnHeaderNumber = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderStartTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderText = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.buttonExport = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
@ -44,7 +45,7 @@
|
||||
this.buttonCancel.Location = new System.Drawing.Point(555, 308);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 0;
|
||||
this.buttonCancel.TabIndex = 30;
|
||||
this.buttonCancel.Text = "C&ancel";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@ -55,7 +56,7 @@
|
||||
this.buttonOK.Location = new System.Drawing.Point(474, 308);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonOK.TabIndex = 2;
|
||||
this.buttonOK.TabIndex = 20;
|
||||
this.buttonOK.Text = "&OK";
|
||||
this.buttonOK.UseVisualStyleBackColor = true;
|
||||
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||
@ -75,7 +76,7 @@
|
||||
this.listViewBookmarks.Location = new System.Drawing.Point(13, 12);
|
||||
this.listViewBookmarks.Name = "listViewBookmarks";
|
||||
this.listViewBookmarks.Size = new System.Drawing.Size(617, 289);
|
||||
this.listViewBookmarks.TabIndex = 1;
|
||||
this.listViewBookmarks.TabIndex = 0;
|
||||
this.listViewBookmarks.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewBookmarks.View = System.Windows.Forms.View.Details;
|
||||
this.listViewBookmarks.DoubleClick += new System.EventHandler(this.listViewBookmarks_DoubleClick);
|
||||
@ -92,11 +93,24 @@
|
||||
//
|
||||
this.columnHeaderText.Width = 480;
|
||||
//
|
||||
// buttonExport
|
||||
//
|
||||
this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonExport.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonExport.Location = new System.Drawing.Point(371, 308);
|
||||
this.buttonExport.Name = "buttonExport";
|
||||
this.buttonExport.Size = new System.Drawing.Size(97, 23);
|
||||
this.buttonExport.TabIndex = 10;
|
||||
this.buttonExport.Text = "Export...";
|
||||
this.buttonExport.UseVisualStyleBackColor = true;
|
||||
this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click);
|
||||
//
|
||||
// BookmarksGoTo
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(642, 341);
|
||||
this.Controls.Add(this.buttonExport);
|
||||
this.Controls.Add(this.listViewBookmarks);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
@ -109,9 +123,9 @@
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "BookmarksGoTo";
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BookmarksGoTo_KeyDown);
|
||||
this.ResizeEnd += new System.EventHandler(this.BookmarksGoTo_ResizeEnd);
|
||||
this.Shown += new System.EventHandler(this.BookmarksGoTo_Shown);
|
||||
this.ResizeEnd += new System.EventHandler(this.BookmarksGoTo_ResizeEnd);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BookmarksGoTo_KeyDown);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -124,5 +138,6 @@
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderNumber;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderStartTime;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderText;
|
||||
private System.Windows.Forms.Button buttonExport;
|
||||
}
|
||||
}
|
@ -2,6 +2,9 @@
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
@ -16,11 +19,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
InitializeComponent();
|
||||
UiUtil.FixFonts(this);
|
||||
Text = LanguageSettings.Current.Bookmarks.GoToBookmark;
|
||||
buttonExport.Text = LanguageSettings.Current.MultipleReplace.Export;
|
||||
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
||||
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||
columnHeaderNumber.Text = LanguageSettings.Current.General.NumberSymbol;
|
||||
columnHeaderStartTime.Text = LanguageSettings.Current.General.StartTime;
|
||||
columnHeaderText.Text = LanguageSettings.Current.General.Text;
|
||||
|
||||
|
||||
_subtitle = subtitle;
|
||||
foreach (var p in subtitle.Paragraphs)
|
||||
{
|
||||
@ -81,6 +87,65 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void BookmarksGoTo_Shown(object sender, EventArgs e)
|
||||
{
|
||||
BookmarksGoTo_ResizeEnd(sender, e);
|
||||
listViewBookmarks.Focus();
|
||||
}
|
||||
|
||||
private void buttonExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportBookmarksAsCsv(_subtitle, this);
|
||||
}
|
||||
|
||||
public static void ExportBookmarksAsCsv(Subtitle subtitle, Form form)
|
||||
{
|
||||
using (var saveDialog = new SaveFileDialog { FileName = string.Empty, Filter = "CSV|*.csv" })
|
||||
{
|
||||
if (saveDialog.ShowDialog(form) != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
foreach (var p in subtitle.Paragraphs.Where(p => p.Bookmark != null))
|
||||
{
|
||||
sb.AppendLine(MakeParagraphCsvLine(p));
|
||||
}
|
||||
|
||||
File.WriteAllText(saveDialog.FileName, sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private static string MakeParagraphCsvLine(Paragraph paragraph)
|
||||
{
|
||||
const string separator = ";";
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(paragraph.Number + separator);
|
||||
sb.Append(ToCsvText(paragraph.StartTime.ToDisplayString()) + separator);
|
||||
sb.Append(ToCsvText(paragraph.EndTime.ToDisplayString()) + separator);
|
||||
sb.Append(ToCsvText(paragraph.Duration.ToShortDisplayString()) + separator);
|
||||
sb.Append(ToCsvText(paragraph.Text) + separator);
|
||||
sb.Append(ToCsvText(paragraph.Bookmark) + separator);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static string ToCsvText(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("\"");
|
||||
foreach (var nextChar in input)
|
||||
{
|
||||
sb.Append(nextChar);
|
||||
if (nextChar == '"')
|
||||
{
|
||||
sb.Append("\"");
|
||||
}
|
||||
}
|
||||
sb.Append("\"");
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29035,6 +29035,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
menuItem.Click += (sender2, e2) => { ClearBookmarks(); };
|
||||
_bookmarkContextMenu.Items.Add(menuItem);
|
||||
|
||||
// export bookmarks
|
||||
menuItem = new ToolStripMenuItem(LanguageSettings.Current.Settings.ExportBookmarks);
|
||||
menuItem.Click += (sender2, e2) => { BookmarksGoTo.ExportBookmarksAsCsv(_subtitle, this); };
|
||||
_bookmarkContextMenu.Items.Add(menuItem);
|
||||
|
||||
UiUtil.FixFonts(_bookmarkContextMenu);
|
||||
pictureBoxBookmark.ContextMenuStrip = _bookmarkContextMenu;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
|
||||
labelSubMaxLen.Text = language.SubtitleLineMaximumLength;
|
||||
labelOptimalCharsPerSecond.Text = language.OptimalCharactersPerSecond;
|
||||
labelMaxCharsPerSecond.Text = language.MaximumCharactersPerSecond;
|
||||
labelMaxWordsPerMin.Text = language.MaximumWordssPerMinute;
|
||||
labelMaxWordsPerMin.Text = language.MaximumWordsPerMinute;
|
||||
labelMinDuration.Text = language.DurationMinimumMilliseconds;
|
||||
labelMaxDuration.Text = language.DurationMaximumMilliseconds;
|
||||
labelMinGapMs.Text = language.MinimumGapMilliseconds;
|
||||
|
@ -5290,6 +5290,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "Settings/ClearBookmarks":
|
||||
language.Settings.ClearBookmarks = reader.Value;
|
||||
break;
|
||||
case "Settings/ExportBookmarks":
|
||||
language.Settings.ExportBookmarks = reader.Value;
|
||||
break;
|
||||
case "Settings/GoToBookmark":
|
||||
language.Settings.GoToBookmark = reader.Value;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user