Add ASSA style - add "Replace" - thxMishasama :)

Work on #6509
This commit is contained in:
niksedk 2022-12-31 18:41:01 +01:00
parent a73d3a8d6f
commit b25b2a0e2e
11 changed files with 587 additions and 48 deletions

View File

@ -17,6 +17,9 @@ namespace Nikse.SubtitleEdit.Core.Common
public bool Forced { get; set; } public bool Forced { get; set; }
/// <summary>
/// Extra info (style name for ASSA).
/// </summary>
public string Extra { get; set; } public string Extra { get; set; }
public bool IsComment { get; set; } public bool IsComment { get; set; }

View File

@ -38,6 +38,7 @@
this.columnHeaderOutline = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderOutline = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStripFile = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStripFile = new System.Windows.Forms.ContextMenuStrip(this.components);
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeAndReplaceWithToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemRemoveAll = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemRemoveAll = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.addToStorageToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.addToStorageToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
@ -213,7 +214,7 @@
this.listViewStyles.HideSelection = false; this.listViewStyles.HideSelection = false;
this.listViewStyles.Location = new System.Drawing.Point(6, 19); this.listViewStyles.Location = new System.Drawing.Point(6, 19);
this.listViewStyles.Name = "listViewStyles"; this.listViewStyles.Name = "listViewStyles";
this.listViewStyles.Size = new System.Drawing.Size(545, 250); this.listViewStyles.Size = new System.Drawing.Size(545, 230);
this.listViewStyles.TabIndex = 0; this.listViewStyles.TabIndex = 0;
this.listViewStyles.UseCompatibleStateImageBehavior = false; this.listViewStyles.UseCompatibleStateImageBehavior = false;
this.listViewStyles.View = System.Windows.Forms.View.Details; this.listViewStyles.View = System.Windows.Forms.View.Details;
@ -256,6 +257,7 @@
this.contextMenuStripFile.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStripFile.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.deleteToolStripMenuItem, this.deleteToolStripMenuItem,
this.toolStripMenuItemRemoveAll, this.toolStripMenuItemRemoveAll,
this.removeAndReplaceWithToolStripMenuItem,
this.toolStripSeparator4, this.toolStripSeparator4,
this.addToStorageToolStripMenuItem1, this.addToStorageToolStripMenuItem1,
this.toolStripSeparator8, this.toolStripSeparator8,
@ -270,7 +272,7 @@
this.toolStripMenuItemImport, this.toolStripMenuItemImport,
this.toolStripMenuItemExport}); this.toolStripMenuItemExport});
this.contextMenuStripFile.Name = "contextMenuStrip1"; this.contextMenuStripFile.Name = "contextMenuStrip1";
this.contextMenuStripFile.Size = new System.Drawing.Size(216, 270); this.contextMenuStripFile.Size = new System.Drawing.Size(216, 314);
this.contextMenuStripFile.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripFile_Opening); this.contextMenuStripFile.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripFile_Opening);
// //
// deleteToolStripMenuItem // deleteToolStripMenuItem
@ -281,6 +283,13 @@
this.deleteToolStripMenuItem.Text = "Remove"; this.deleteToolStripMenuItem.Text = "Remove";
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.buttonRemove_Click); this.deleteToolStripMenuItem.Click += new System.EventHandler(this.buttonRemove_Click);
// //
// removeAndReplaceWithToolStripMenuItem
//
this.removeAndReplaceWithToolStripMenuItem.Name = "removeAndReplaceWithToolStripMenuItem";
this.removeAndReplaceWithToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
this.removeAndReplaceWithToolStripMenuItem.Text = "Replace with...";
this.removeAndReplaceWithToolStripMenuItem.Click += new System.EventHandler(this.buttonRemoveAndReplaceWith_Click);
//
// toolStripMenuItemRemoveAll // toolStripMenuItemRemoveAll
// //
this.toolStripMenuItemRemoveAll.Name = "toolStripMenuItemRemoveAll"; this.toolStripMenuItemRemoveAll.Name = "toolStripMenuItemRemoveAll";
@ -385,7 +394,7 @@
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(977, 676); this.buttonCancel.Location = new System.Drawing.Point(977, 637);
this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 3; this.buttonCancel.TabIndex = 3;
@ -397,7 +406,7 @@
// //
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(896, 676); this.buttonOK.Location = new System.Drawing.Point(896, 637);
this.buttonOK.Name = "buttonOK"; this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2; this.buttonOK.TabIndex = 2;
@ -418,7 +427,7 @@
this.groupBoxStyles.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBoxStyles.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBoxStyles.Location = new System.Drawing.Point(0, 0); this.groupBoxStyles.Location = new System.Drawing.Point(0, 0);
this.groupBoxStyles.Name = "groupBoxStyles"; this.groupBoxStyles.Name = "groupBoxStyles";
this.groupBoxStyles.Size = new System.Drawing.Size(557, 333); this.groupBoxStyles.Size = new System.Drawing.Size(557, 313);
this.groupBoxStyles.TabIndex = 0; this.groupBoxStyles.TabIndex = 0;
this.groupBoxStyles.TabStop = false; this.groupBoxStyles.TabStop = false;
this.groupBoxStyles.Text = "File styles"; this.groupBoxStyles.Text = "File styles";
@ -427,7 +436,7 @@
// //
this.buttonAddStyleToStorage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonAddStyleToStorage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonAddStyleToStorage.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonAddStyleToStorage.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonAddStyleToStorage.Location = new System.Drawing.Point(290, 275); this.buttonAddStyleToStorage.Location = new System.Drawing.Point(290, 255);
this.buttonAddStyleToStorage.Name = "buttonAddStyleToStorage"; this.buttonAddStyleToStorage.Name = "buttonAddStyleToStorage";
this.buttonAddStyleToStorage.Size = new System.Drawing.Size(163, 52); this.buttonAddStyleToStorage.Size = new System.Drawing.Size(163, 52);
this.buttonAddStyleToStorage.TabIndex = 4; this.buttonAddStyleToStorage.TabIndex = 4;
@ -439,7 +448,7 @@
// //
this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonExport.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonExport.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonExport.Location = new System.Drawing.Point(6, 304); this.buttonExport.Location = new System.Drawing.Point(6, 284);
this.buttonExport.Name = "buttonExport"; this.buttonExport.Name = "buttonExport";
this.buttonExport.Size = new System.Drawing.Size(82, 23); this.buttonExport.Size = new System.Drawing.Size(82, 23);
this.buttonExport.TabIndex = 5; this.buttonExport.TabIndex = 5;
@ -451,7 +460,7 @@
// //
this.buttonImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonImport.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonImport.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonImport.Location = new System.Drawing.Point(6, 275); this.buttonImport.Location = new System.Drawing.Point(6, 255);
this.buttonImport.Name = "buttonImport"; this.buttonImport.Name = "buttonImport";
this.buttonImport.Size = new System.Drawing.Size(82, 23); this.buttonImport.Size = new System.Drawing.Size(82, 23);
this.buttonImport.TabIndex = 1; this.buttonImport.TabIndex = 1;
@ -463,7 +472,7 @@
// //
this.buttonCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonCopy.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonCopy.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCopy.Location = new System.Drawing.Point(94, 304); this.buttonCopy.Location = new System.Drawing.Point(94, 284);
this.buttonCopy.Name = "buttonCopy"; this.buttonCopy.Name = "buttonCopy";
this.buttonCopy.Size = new System.Drawing.Size(82, 23); this.buttonCopy.Size = new System.Drawing.Size(82, 23);
this.buttonCopy.TabIndex = 6; this.buttonCopy.TabIndex = 6;
@ -475,7 +484,7 @@
// //
this.buttonRemoveAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonRemoveAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonRemoveAll.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonRemoveAll.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonRemoveAll.Location = new System.Drawing.Point(182, 304); this.buttonRemoveAll.Location = new System.Drawing.Point(182, 284);
this.buttonRemoveAll.Name = "buttonRemoveAll"; this.buttonRemoveAll.Name = "buttonRemoveAll";
this.buttonRemoveAll.Size = new System.Drawing.Size(102, 23); this.buttonRemoveAll.Size = new System.Drawing.Size(102, 23);
this.buttonRemoveAll.TabIndex = 7; this.buttonRemoveAll.TabIndex = 7;
@ -487,7 +496,7 @@
// //
this.buttonAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonAdd.Location = new System.Drawing.Point(94, 275); this.buttonAdd.Location = new System.Drawing.Point(94, 255);
this.buttonAdd.Name = "buttonAdd"; this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(82, 23); this.buttonAdd.Size = new System.Drawing.Size(82, 23);
this.buttonAdd.TabIndex = 2; this.buttonAdd.TabIndex = 2;
@ -499,7 +508,7 @@
// //
this.buttonRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonRemove.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonRemove.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonRemove.Location = new System.Drawing.Point(182, 275); this.buttonRemove.Location = new System.Drawing.Point(182, 255);
this.buttonRemove.Name = "buttonRemove"; this.buttonRemove.Name = "buttonRemove";
this.buttonRemove.Size = new System.Drawing.Size(102, 23); this.buttonRemove.Size = new System.Drawing.Size(102, 23);
this.buttonRemove.TabIndex = 3; this.buttonRemove.TabIndex = 3;
@ -522,7 +531,7 @@
this.groupBoxProperties.Controls.Add(this.groupBoxFont); this.groupBoxProperties.Controls.Add(this.groupBoxFont);
this.groupBoxProperties.Location = new System.Drawing.Point(575, 4); this.groupBoxProperties.Location = new System.Drawing.Point(575, 4);
this.groupBoxProperties.Name = "groupBoxProperties"; this.groupBoxProperties.Name = "groupBoxProperties";
this.groupBoxProperties.Size = new System.Drawing.Size(477, 666); this.groupBoxProperties.Size = new System.Drawing.Size(477, 627);
this.groupBoxProperties.TabIndex = 0; this.groupBoxProperties.TabIndex = 0;
this.groupBoxProperties.TabStop = false; this.groupBoxProperties.TabStop = false;
this.groupBoxProperties.Text = "Properties"; this.groupBoxProperties.Text = "Properties";
@ -925,7 +934,7 @@
this.groupBoxPreview.Controls.Add(this.pictureBoxPreview); this.groupBoxPreview.Controls.Add(this.pictureBoxPreview);
this.groupBoxPreview.Location = new System.Drawing.Point(7, 335); this.groupBoxPreview.Location = new System.Drawing.Point(7, 335);
this.groupBoxPreview.Name = "groupBoxPreview"; this.groupBoxPreview.Name = "groupBoxPreview";
this.groupBoxPreview.Size = new System.Drawing.Size(465, 325); this.groupBoxPreview.Size = new System.Drawing.Size(465, 286);
this.groupBoxPreview.TabIndex = 7; this.groupBoxPreview.TabIndex = 7;
this.groupBoxPreview.TabStop = false; this.groupBoxPreview.TabStop = false;
this.groupBoxPreview.Text = "Preview"; this.groupBoxPreview.Text = "Preview";
@ -936,7 +945,7 @@
this.pictureBoxPreview.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBoxPreview.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxPreview.Location = new System.Drawing.Point(3, 16); this.pictureBoxPreview.Location = new System.Drawing.Point(3, 16);
this.pictureBoxPreview.Name = "pictureBoxPreview"; this.pictureBoxPreview.Name = "pictureBoxPreview";
this.pictureBoxPreview.Size = new System.Drawing.Size(459, 306); this.pictureBoxPreview.Size = new System.Drawing.Size(459, 267);
this.pictureBoxPreview.TabIndex = 0; this.pictureBoxPreview.TabIndex = 0;
this.pictureBoxPreview.TabStop = false; this.pictureBoxPreview.TabStop = false;
this.pictureBoxPreview.Click += new System.EventHandler(this.pictureBoxPreview_Click); this.pictureBoxPreview.Click += new System.EventHandler(this.pictureBoxPreview_Click);
@ -1222,7 +1231,7 @@
this.groupBoxStorage.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBoxStorage.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBoxStorage.Location = new System.Drawing.Point(0, 0); this.groupBoxStorage.Location = new System.Drawing.Point(0, 0);
this.groupBoxStorage.Name = "groupBoxStorage"; this.groupBoxStorage.Name = "groupBoxStorage";
this.groupBoxStorage.Size = new System.Drawing.Size(557, 329); this.groupBoxStorage.Size = new System.Drawing.Size(557, 310);
this.groupBoxStorage.TabIndex = 0; this.groupBoxStorage.TabIndex = 0;
this.groupBoxStorage.TabStop = false; this.groupBoxStorage.TabStop = false;
this.groupBoxStorage.Text = "Style storage"; this.groupBoxStorage.Text = "Style storage";
@ -1231,7 +1240,7 @@
// //
this.buttonAddToFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonAddToFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonAddToFile.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonAddToFile.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonAddToFile.Location = new System.Drawing.Point(290, 271); this.buttonAddToFile.Location = new System.Drawing.Point(290, 252);
this.buttonAddToFile.Name = "buttonAddToFile"; this.buttonAddToFile.Name = "buttonAddToFile";
this.buttonAddToFile.Size = new System.Drawing.Size(163, 52); this.buttonAddToFile.Size = new System.Drawing.Size(163, 52);
this.buttonAddToFile.TabIndex = 10; this.buttonAddToFile.TabIndex = 10;
@ -1243,7 +1252,7 @@
// //
this.buttonStorageExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonStorageExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonStorageExport.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonStorageExport.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonStorageExport.Location = new System.Drawing.Point(6, 300); this.buttonStorageExport.Location = new System.Drawing.Point(6, 281);
this.buttonStorageExport.Name = "buttonStorageExport"; this.buttonStorageExport.Name = "buttonStorageExport";
this.buttonStorageExport.Size = new System.Drawing.Size(82, 23); this.buttonStorageExport.Size = new System.Drawing.Size(82, 23);
this.buttonStorageExport.TabIndex = 11; this.buttonStorageExport.TabIndex = 11;
@ -1255,7 +1264,7 @@
// //
this.buttonStorageImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonStorageImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonStorageImport.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonStorageImport.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonStorageImport.Location = new System.Drawing.Point(6, 271); this.buttonStorageImport.Location = new System.Drawing.Point(6, 252);
this.buttonStorageImport.Name = "buttonStorageImport"; this.buttonStorageImport.Name = "buttonStorageImport";
this.buttonStorageImport.Size = new System.Drawing.Size(82, 23); this.buttonStorageImport.Size = new System.Drawing.Size(82, 23);
this.buttonStorageImport.TabIndex = 7; this.buttonStorageImport.TabIndex = 7;
@ -1267,7 +1276,7 @@
// //
this.buttonStorageCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonStorageCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonStorageCopy.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonStorageCopy.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonStorageCopy.Location = new System.Drawing.Point(94, 300); this.buttonStorageCopy.Location = new System.Drawing.Point(94, 281);
this.buttonStorageCopy.Name = "buttonStorageCopy"; this.buttonStorageCopy.Name = "buttonStorageCopy";
this.buttonStorageCopy.Size = new System.Drawing.Size(82, 23); this.buttonStorageCopy.Size = new System.Drawing.Size(82, 23);
this.buttonStorageCopy.TabIndex = 12; this.buttonStorageCopy.TabIndex = 12;
@ -1279,7 +1288,7 @@
// //
this.buttonStorageRemoveAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonStorageRemoveAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonStorageRemoveAll.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonStorageRemoveAll.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonStorageRemoveAll.Location = new System.Drawing.Point(182, 300); this.buttonStorageRemoveAll.Location = new System.Drawing.Point(182, 281);
this.buttonStorageRemoveAll.Name = "buttonStorageRemoveAll"; this.buttonStorageRemoveAll.Name = "buttonStorageRemoveAll";
this.buttonStorageRemoveAll.Size = new System.Drawing.Size(102, 23); this.buttonStorageRemoveAll.Size = new System.Drawing.Size(102, 23);
this.buttonStorageRemoveAll.TabIndex = 13; this.buttonStorageRemoveAll.TabIndex = 13;
@ -1291,7 +1300,7 @@
// //
this.buttonStorageAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonStorageAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonStorageAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonStorageAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonStorageAdd.Location = new System.Drawing.Point(94, 271); this.buttonStorageAdd.Location = new System.Drawing.Point(94, 252);
this.buttonStorageAdd.Name = "buttonStorageAdd"; this.buttonStorageAdd.Name = "buttonStorageAdd";
this.buttonStorageAdd.Size = new System.Drawing.Size(82, 23); this.buttonStorageAdd.Size = new System.Drawing.Size(82, 23);
this.buttonStorageAdd.TabIndex = 8; this.buttonStorageAdd.TabIndex = 8;
@ -1303,7 +1312,7 @@
// //
this.buttonStorageRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonStorageRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonStorageRemove.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonStorageRemove.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonStorageRemove.Location = new System.Drawing.Point(182, 271); this.buttonStorageRemove.Location = new System.Drawing.Point(182, 252);
this.buttonStorageRemove.Name = "buttonStorageRemove"; this.buttonStorageRemove.Name = "buttonStorageRemove";
this.buttonStorageRemove.Size = new System.Drawing.Size(102, 23); this.buttonStorageRemove.Size = new System.Drawing.Size(102, 23);
this.buttonStorageRemove.TabIndex = 9; this.buttonStorageRemove.TabIndex = 9;
@ -1328,7 +1337,7 @@
this.listViewStorage.HideSelection = false; this.listViewStorage.HideSelection = false;
this.listViewStorage.Location = new System.Drawing.Point(6, 68); this.listViewStorage.Location = new System.Drawing.Point(6, 68);
this.listViewStorage.Name = "listViewStorage"; this.listViewStorage.Name = "listViewStorage";
this.listViewStorage.Size = new System.Drawing.Size(545, 197); this.listViewStorage.Size = new System.Drawing.Size(545, 178);
this.listViewStorage.TabIndex = 6; this.listViewStorage.TabIndex = 6;
this.listViewStorage.UseCompatibleStateImageBehavior = false; this.listViewStorage.UseCompatibleStateImageBehavior = false;
this.listViewStorage.View = System.Windows.Forms.View.Details; this.listViewStorage.View = System.Windows.Forms.View.Details;
@ -1588,15 +1597,15 @@
// //
this.splitContainer1.Panel2.Controls.Add(this.groupBoxStorage); this.splitContainer1.Panel2.Controls.Add(this.groupBoxStorage);
this.splitContainer1.Panel2MinSize = 150; this.splitContainer1.Panel2MinSize = 150;
this.splitContainer1.Size = new System.Drawing.Size(557, 666); this.splitContainer1.Size = new System.Drawing.Size(557, 627);
this.splitContainer1.SplitterDistance = 333; this.splitContainer1.SplitterDistance = 313;
this.splitContainer1.TabIndex = 8; this.splitContainer1.TabIndex = 8;
// //
// buttonApply // buttonApply
// //
this.buttonApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonApply.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonApply.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonApply.Location = new System.Drawing.Point(785, 676); this.buttonApply.Location = new System.Drawing.Point(785, 637);
this.buttonApply.Name = "buttonApply"; this.buttonApply.Name = "buttonApply";
this.buttonApply.Size = new System.Drawing.Size(105, 23); this.buttonApply.Size = new System.Drawing.Size(105, 23);
this.buttonApply.TabIndex = 1; this.buttonApply.TabIndex = 1;
@ -1610,7 +1619,7 @@
this.labelDuplicateStyleNames.AutoSize = true; this.labelDuplicateStyleNames.AutoSize = true;
this.labelDuplicateStyleNames.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelDuplicateStyleNames.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelDuplicateStyleNames.ForeColor = System.Drawing.Color.Firebrick; this.labelDuplicateStyleNames.ForeColor = System.Drawing.Color.Firebrick;
this.labelDuplicateStyleNames.Location = new System.Drawing.Point(12, 687); this.labelDuplicateStyleNames.Location = new System.Drawing.Point(12, 648);
this.labelDuplicateStyleNames.Name = "labelDuplicateStyleNames"; this.labelDuplicateStyleNames.Name = "labelDuplicateStyleNames";
this.labelDuplicateStyleNames.Size = new System.Drawing.Size(154, 13); this.labelDuplicateStyleNames.Size = new System.Drawing.Size(154, 13);
this.labelDuplicateStyleNames.TabIndex = 10; this.labelDuplicateStyleNames.TabIndex = 10;
@ -1620,7 +1629,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1064, 709); this.ClientSize = new System.Drawing.Size(1064, 670);
this.Controls.Add(this.labelDuplicateStyleNames); this.Controls.Add(this.labelDuplicateStyleNames);
this.Controls.Add(this.buttonApply); this.Controls.Add(this.buttonApply);
this.Controls.Add(this.splitContainer1); this.Controls.Add(this.splitContainer1);
@ -1819,5 +1828,6 @@
private System.Windows.Forms.Label labelScaleX; private System.Windows.Forms.Label labelScaleX;
private System.Windows.Forms.ComboBox comboBoxOpaqueBoxStyle; private System.Windows.Forms.ComboBox comboBoxOpaqueBoxStyle;
private System.Windows.Forms.Label labelDuplicateStyleNames; private System.Windows.Forms.Label labelDuplicateStyleNames;
private System.Windows.Forms.ToolStripMenuItem removeAndReplaceWithToolStripMenuItem;
} }
} }

View File

@ -60,7 +60,7 @@ namespace Nikse.SubtitleEdit.Forms.Assa
InitializeComponent(); InitializeComponent();
UiUtil.FixFonts(this); UiUtil.FixFonts(this);
_subtitle = subtitle; _subtitle = new Subtitle(subtitle);
RenameActions = new List<NameEdit>(); RenameActions = new List<NameEdit>();
labelStatus.Text = string.Empty; labelStatus.Text = string.Empty;
_header = subtitle.Header; _header = subtitle.Header;
@ -181,6 +181,7 @@ namespace Nikse.SubtitleEdit.Forms.Assa
buttonAddStyleToStorage.Text = l.AddToStorage; buttonAddStyleToStorage.Text = l.AddToStorage;
deleteToolStripMenuItem.Text = l.Remove; deleteToolStripMenuItem.Text = l.Remove;
removeAndReplaceWithToolStripMenuItem.Text = l.ReplaceWith;
toolStripMenuItemRemoveAll.Text = l.RemoveAll; toolStripMenuItemRemoveAll.Text = l.RemoveAll;
addToStorageToolStripMenuItem1.Text = l.AddToStorage; addToStorageToolStripMenuItem1.Text = l.AddToStorage;
moveUpToolStripMenuItem.Text = LanguageSettings.Current.DvdSubRip.MoveUp; moveUpToolStripMenuItem.Text = LanguageSettings.Current.DvdSubRip.MoveUp;
@ -993,16 +994,16 @@ namespace Nikse.SubtitleEdit.Forms.Assa
AddStyle(listViewStorage, defaultStyle, _subtitle, _isSubStationAlpha); AddStyle(listViewStorage, defaultStyle, _subtitle, _isSubStationAlpha);
} }
private void UpdateSelectedIndices(ListView listview, int startingIndex = -1, int numberOfSelectedItems = 1) private static void UpdateSelectedIndices(ListView listView, int startingIndex = -1, int numberOfSelectedItems = 1)
{ {
if (numberOfSelectedItems == 0) if (numberOfSelectedItems == 0)
{ {
return; return;
} }
if (startingIndex == -1 || startingIndex >= listview.Items.Count) if (startingIndex == -1 || startingIndex >= listView.Items.Count)
{ {
startingIndex = listview.Items.Count - 1; startingIndex = listView.Items.Count - 1;
} }
if (startingIndex - numberOfSelectedItems < -1) if (startingIndex - numberOfSelectedItems < -1)
@ -1010,12 +1011,12 @@ namespace Nikse.SubtitleEdit.Forms.Assa
return; return;
} }
listview.SelectedItems.Clear(); listView.SelectedItems.Clear();
for (int i = 0; i < numberOfSelectedItems; i++) for (var i = 0; i < numberOfSelectedItems; i++)
{ {
listview.Items[startingIndex - i].Selected = true; listView.Items[startingIndex - i].Selected = true;
listview.Items[startingIndex - i].EnsureVisible(); listView.Items[startingIndex - i].EnsureVisible();
listview.Items[startingIndex - i].Focused = true; listView.Items[startingIndex - i].Focused = true;
} }
} }
@ -1400,8 +1401,8 @@ namespace Nikse.SubtitleEdit.Forms.Assa
var name = LanguageSettings.Current.SubStationAlphaStyles.New; var name = LanguageSettings.Current.SubStationAlphaStyles.New;
if (GetSsaStyleFile(name) != null) if (GetSsaStyleFile(name) != null)
{ {
int count = 2; var count = 2;
bool doRepeat = true; var doRepeat = true;
while (doRepeat) while (doRepeat)
{ {
name = LanguageSettings.Current.SubStationAlphaStyles.New + count; name = LanguageSettings.Current.SubStationAlphaStyles.New + count;
@ -1512,6 +1513,42 @@ namespace Nikse.SubtitleEdit.Forms.Assa
CheckDuplicateStyles(); CheckDuplicateStyles();
} }
private void buttonRemoveAndReplaceWith_Click(object sender, EventArgs e)
{
if (listViewStyles.SelectedItems.Count != 1)
{
return;
}
var idx = listViewStyles.SelectedIndices[0];
var style = _currentFileStyles[idx];
using (var form = new ReplaceStyleWith(style, _currentFileStyles, _storageCategories, _subtitle))
{
if (form.ShowDialog(this) == DialogResult.OK)
{
_subtitle.Paragraphs.Clear();
_subtitle.Paragraphs.AddRange(form.NewSubtitle.Paragraphs);
_currentFileStyles.Remove(style);
if (form.NewStorageStyle != null)
{
AddStyle(listViewStyles, form.NewStorageStyle, _subtitle, _isSubStationAlpha);
AddStyleToHeader(form.NewStorageStyle);
_doUpdate = true;
UpdateSelectedIndices(listViewStyles);
SetControlsFromStyle(form.NewStorageStyle);
RenameActions.Add(new NameEdit(style.Name, form.NewStorageStyle.Name));
InitializeStylesListView(form.NewStorageStyle.Name);
}
else
{
RenameActions.Add(new NameEdit(style.Name, form.NewFileStyle.Name));
InitializeStylesListView(form.NewFileStyle.Name);
}
}
}
}
private void buttonRemoveAll_Click(object sender, EventArgs e) private void buttonRemoveAll_Click(object sender, EventArgs e)
{ {
var askText = listViewStyles.Items.Count == 1 ? var askText = listViewStyles.Items.Count == 1 ?
@ -2114,8 +2151,8 @@ namespace Nikse.SubtitleEdit.Forms.Assa
var name = LanguageSettings.Current.SubStationAlphaStyles.New; var name = LanguageSettings.Current.SubStationAlphaStyles.New;
if (_currentCategory.Styles.Any(p => p.Name == name)) if (_currentCategory.Styles.Any(p => p.Name == name))
{ {
int count = 2; var count = 2;
bool doRepeat = true; var doRepeat = true;
while (doRepeat) while (doRepeat)
{ {
name = LanguageSettings.Current.SubStationAlphaStyles.New + count; name = LanguageSettings.Current.SubStationAlphaStyles.New + count;
@ -2146,8 +2183,8 @@ namespace Nikse.SubtitleEdit.Forms.Assa
var style = new SsaStyle(oldStyle) { Name = string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyOfY, styleName) }; // Copy contructor var style = new SsaStyle(oldStyle) { Name = string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyOfY, styleName) }; // Copy contructor
if (_currentCategory.Styles.Any(p => p.Name == style.Name)) if (_currentCategory.Styles.Any(p => p.Name == style.Name))
{ {
int count = 2; var count = 2;
bool doRepeat = true; var doRepeat = true;
while (doRepeat) while (doRepeat)
{ {
style.Name = string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyXOfY, count, styleName); style.Name = string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyXOfY, count, styleName);
@ -2721,6 +2758,7 @@ namespace Nikse.SubtitleEdit.Forms.Assa
var oneOrMoreSelected = listViewStyles.SelectedItems.Count > 0; var oneOrMoreSelected = listViewStyles.SelectedItems.Count > 0;
deleteToolStripMenuItem.Visible = oneOrMoreSelected; deleteToolStripMenuItem.Visible = oneOrMoreSelected;
removeAndReplaceWithToolStripMenuItem.Visible = listViewStyles.SelectedItems.Count == 1;
addToStorageToolStripMenuItem1.Visible = oneOrMoreSelected; addToStorageToolStripMenuItem1.Visible = oneOrMoreSelected;
toolStripSeparator4.Visible = oneOrMoreSelected; toolStripSeparator4.Visible = oneOrMoreSelected;
copyToolStripMenuItemCopy.Visible = oneOrMoreSelected; copyToolStripMenuItemCopy.Visible = oneOrMoreSelected;

View File

@ -138,4 +138,7 @@
<metadata name="contextMenuStripStorage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenuStripStorage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>11, 22</value> <value>11, 22</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>58</value>
</metadata>
</root> </root>

View File

@ -0,0 +1,161 @@
namespace Nikse.SubtitleEdit.Forms.Assa
{
partial class ReplaceStyleWith
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.comboBoxFrom = new System.Windows.Forms.ComboBox();
this.labelFrom = new System.Windows.Forms.Label();
this.comboboxStorageCategories = new System.Windows.Forms.ComboBox();
this.labelStorageCategory = new System.Windows.Forms.Label();
this.comboBoxStyle = new System.Windows.Forms.ComboBox();
this.labelStyle = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(247, 186);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 6;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(328, 186);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 7;
this.buttonCancel.Text = "C&ancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// comboBoxFrom
//
this.comboBoxFrom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxFrom.FormattingEnabled = true;
this.comboBoxFrom.Location = new System.Drawing.Point(88, 29);
this.comboBoxFrom.Name = "comboBoxFrom";
this.comboBoxFrom.Size = new System.Drawing.Size(180, 21);
this.comboBoxFrom.TabIndex = 12;
this.comboBoxFrom.SelectedIndexChanged += new System.EventHandler(this.comboBoxFrom_SelectedIndexChanged);
//
// labelFrom
//
this.labelFrom.AutoSize = true;
this.labelFrom.Location = new System.Drawing.Point(25, 31);
this.labelFrom.Name = "labelFrom";
this.labelFrom.Size = new System.Drawing.Size(30, 13);
this.labelFrom.TabIndex = 11;
this.labelFrom.Text = "From";
//
// comboboxStorageCategories
//
this.comboboxStorageCategories.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboboxStorageCategories.FormattingEnabled = true;
this.comboboxStorageCategories.Location = new System.Drawing.Point(88, 56);
this.comboboxStorageCategories.Name = "comboboxStorageCategories";
this.comboboxStorageCategories.Size = new System.Drawing.Size(180, 21);
this.comboboxStorageCategories.TabIndex = 10;
this.comboboxStorageCategories.SelectedIndexChanged += new System.EventHandler(this.comboboxStorageCategories_SelectedIndexChanged);
//
// labelStorageCategory
//
this.labelStorageCategory.AutoSize = true;
this.labelStorageCategory.Location = new System.Drawing.Point(25, 58);
this.labelStorageCategory.Name = "labelStorageCategory";
this.labelStorageCategory.Size = new System.Drawing.Size(49, 13);
this.labelStorageCategory.TabIndex = 9;
this.labelStorageCategory.Text = "Category";
//
// comboBoxStyle
//
this.comboBoxStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxStyle.FormattingEnabled = true;
this.comboBoxStyle.Location = new System.Drawing.Point(88, 83);
this.comboBoxStyle.Name = "comboBoxStyle";
this.comboBoxStyle.Size = new System.Drawing.Size(180, 21);
this.comboBoxStyle.TabIndex = 14;
this.comboBoxStyle.SelectedIndexChanged += new System.EventHandler(this.comboBoxStyle_SelectedIndexChanged);
//
// labelStyle
//
this.labelStyle.AutoSize = true;
this.labelStyle.Location = new System.Drawing.Point(25, 85);
this.labelStyle.Name = "labelStyle";
this.labelStyle.Size = new System.Drawing.Size(30, 13);
this.labelStyle.TabIndex = 13;
this.labelStyle.Text = "Style";
//
// ReplaceStyleWith
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(415, 221);
this.Controls.Add(this.comboBoxStyle);
this.Controls.Add(this.labelStyle);
this.Controls.Add(this.comboBoxFrom);
this.Controls.Add(this.labelFrom);
this.Controls.Add(this.comboboxStorageCategories);
this.Controls.Add(this.labelStorageCategory);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ReplaceStyleWith";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "ReplaceStyleWith";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.ComboBox comboBoxFrom;
private System.Windows.Forms.Label labelFrom;
private System.Windows.Forms.ComboBox comboboxStorageCategories;
private System.Windows.Forms.Label labelStorageCategory;
private System.Windows.Forms.ComboBox comboBoxStyle;
private System.Windows.Forms.Label labelStyle;
}
}

View File

@ -0,0 +1,193 @@
using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Logic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Nikse.SubtitleEdit.Forms.Assa
{
public sealed partial class ReplaceStyleWith : Form
{
private readonly SsaStyle _style;
private readonly List<AssaStorageCategory> _storageCategories;
private readonly List<SsaStyle> _currentFileStyles;
private readonly Subtitle _subtitle;
public Subtitle NewSubtitle { get; set; }
public SsaStyle NewStorageStyle { get; set; }
public SsaStyle NewFileStyle { get; set; }
public ReplaceStyleWith(SsaStyle style, List<SsaStyle> currentFileStyles, List<AssaStorageCategory> storageCategories, Subtitle subtitle)
{
UiUtil.PreInitialize(this);
InitializeComponent();
UiUtil.FixFonts(this);
_style = style;
_currentFileStyles = currentFileStyles;
_storageCategories = storageCategories;
_subtitle = subtitle;
var l = LanguageSettings.Current.SubStationAlphaStyles;
Text = l.ReplaceWith.Trim('.');
labelFrom.Text = LanguageSettings.Current.GoogleTranslate.From;
labelStorageCategory.Text = LanguageSettings.Current.SubStationAlphaStylesCategoriesManager.Category;
labelStyle.Text = LanguageSettings.Current.General.Style;
comboBoxFrom.Items.Clear();
comboBoxFrom.Items.Add(l.StyleCurrentFile);
comboBoxFrom.Items.Add(l.StyleStorage);
comboboxStorageCategories.Items.Clear();
foreach (var category in storageCategories)
{
comboboxStorageCategories.Items.Add(category.Name);
}
comboBoxFrom.SelectedIndex = 0;
buttonOK.Text = LanguageSettings.Current.General.Ok;
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
UiUtil.FixLargeFonts(this, buttonOK);
UpdateButtonOkEnabled();
}
private void UpdateButtonOkEnabled()
{
buttonOK.Enabled = comboBoxStyle.SelectedIndex >= 0;
}
private void comboBoxFrom_SelectedIndexChanged(object sender, EventArgs e)
{
comboBoxStyle.BeginUpdate();
comboBoxStyle.Items.Clear();
if (comboBoxFrom.SelectedIndex == 0)
{
labelStorageCategory.Enabled = false;
comboboxStorageCategories.Enabled = false;
foreach (var style in _currentFileStyles)
{
if (style.Name != _style.Name)
{
comboBoxStyle.Items.Add(style.Name);
}
}
if (comboBoxStyle.Items.Count > 0)
{
comboBoxStyle.SelectedIndex = 0;
}
}
else if (comboBoxFrom.SelectedIndex == 1)
{
labelStorageCategory.Enabled = true;
comboboxStorageCategories.Enabled = true;
if (_storageCategories.Count > 0)
{
comboboxStorageCategories.SelectedIndex = 0;
}
}
else
{
labelStorageCategory.Enabled = true;
comboboxStorageCategories.Enabled = true;
}
comboBoxStyle.EndUpdate();
}
private void comboboxStorageCategories_SelectedIndexChanged(object sender, EventArgs e)
{
if (!comboboxStorageCategories.Enabled || comboboxStorageCategories.SelectedIndex < 0)
{
return;
}
comboBoxStyle.BeginUpdate();
comboBoxStyle.Items.Clear();
var cat = _storageCategories[comboboxStorageCategories.SelectedIndex];
foreach (var style in cat.Styles)
{
comboBoxStyle.Items.Add(style.Name);
}
comboBoxStyle.EndUpdate();
if (comboBoxStyle.Items.Count > 0)
{
comboBoxStyle.SelectedIndex = 0;
}
UpdateButtonOkEnabled();
}
private void buttonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void buttonOK_Click(object sender, EventArgs e)
{
var idx = comboBoxStyle.SelectedIndex;
if (idx < 0)
{
return;
}
NewSubtitle = new Subtitle(_subtitle);
if (comboBoxFrom.SelectedIndex == 0) // current file styles
{
var style = _currentFileStyles[idx];
foreach (var paragraph in NewSubtitle.Paragraphs)
{
if (paragraph.Extra == _style.Name)
{
paragraph.Extra = style.Name;
}
}
NewFileStyle = style;
}
else if (comboBoxFrom.SelectedIndex == 1) // storage style
{
var category = _storageCategories[comboboxStorageCategories.SelectedIndex];
var style = category.Styles[idx];
foreach (var paragraph in NewSubtitle.Paragraphs)
{
if (paragraph.Extra == _style.Name)
{
paragraph.Extra = style.Name;
}
}
NewStorageStyle = style;
if (_currentFileStyles.Any(p => p.Name == NewStorageStyle.Name))
{
var count = 2;
var doRepeat = true;
while (doRepeat)
{
NewStorageStyle.Name = LanguageSettings.Current.SubStationAlphaStyles.New + count;
doRepeat = _currentFileStyles.Any(p => p.Name == NewStorageStyle.Name);
count++;
}
}
}
else
{
return;
}
DialogResult = DialogResult.OK;
}
private void comboBoxStyle_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateButtonOkEnabled();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -3800,10 +3800,10 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged; SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
RemoveOriginal(true, false); RemoveOriginal(true, false);
//if (!format.HasStyleSupport) -- remove -- see https://www.nikse.dk/Home/Details/637741307830000000 if (format.HasStyleSupport && format.Name == AdvancedSubStationAlpha.NameOfFormat)
//{ {
// SubtitleListview1.HideColumn(SubtitleListView.SubtitleColumn.Extra); SubtitleListview1.ShowExtraColumn(_languageGeneral.Style);
//} }
new BookmarkPersistence(newSubtitle, fileName).Load(); new BookmarkPersistence(newSubtitle, fileName).Load();

View File

@ -3241,6 +3241,7 @@ can edit in same subtitle file (collaboration)",
CopyOfY = "Copy of {0}", CopyOfY = "Copy of {0}",
CopyXOfY = "Copy {0} of {1}", CopyXOfY = "Copy {0} of {1}",
Remove = "Remove", Remove = "Remove",
ReplaceWith = "Replace with...",
RemoveAll = "Remove all", RemoveAll = "Remove all",
ImportStyleFromFile = "Import style from file...", ImportStyleFromFile = "Import style from file...",
ExportStyleToFile = "Export style to file... (will add style if file already exists)", ExportStyleToFile = "Export style to file... (will add style if file already exists)",

View File

@ -3090,6 +3090,7 @@ namespace Nikse.SubtitleEdit.Logic
public string CopyXOfY { get; set; } public string CopyXOfY { get; set; }
public string New { get; set; } public string New { get; set; }
public string Remove { get; set; } public string Remove { get; set; }
public string ReplaceWith { get; set; }
public string RemoveAll { get; set; } public string RemoveAll { get; set; }
public string ImportStyleFromFile { get; set; } public string ImportStyleFromFile { get; set; }
public string ExportStyleToFile { get; set; } public string ExportStyleToFile { get; set; }

View File

@ -180,6 +180,12 @@
<Compile Include="Forms\Assa\ImageColorPicker.Designer.cs"> <Compile Include="Forms\Assa\ImageColorPicker.Designer.cs">
<DependentUpon>ImageColorPicker.cs</DependentUpon> <DependentUpon>ImageColorPicker.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Forms\Assa\ReplaceStyleWith.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Assa\ReplaceStyleWith.Designer.cs">
<DependentUpon>ReplaceStyleWith.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Assa\ResolutionResampler.cs"> <Compile Include="Forms\Assa\ResolutionResampler.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -1509,6 +1515,9 @@
<EmbeddedResource Include="Forms\Assa\ImageColorPicker.resx"> <EmbeddedResource Include="Forms\Assa\ImageColorPicker.resx">
<DependentUpon>ImageColorPicker.cs</DependentUpon> <DependentUpon>ImageColorPicker.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\Assa\ReplaceStyleWith.resx">
<DependentUpon>ReplaceStyleWith.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Assa\ResolutionResampler.resx"> <EmbeddedResource Include="Forms\Assa\ResolutionResampler.resx">
<DependentUpon>ResolutionResampler.cs</DependentUpon> <DependentUpon>ResolutionResampler.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>