mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
Merge pull request #71 from ivandrofly/master
MultipleReplace updated & fixed
This commit is contained in:
commit
e817d77b05
4
src/Forms/MergeDoubleLines.Designer.cs
generated
4
src/Forms/MergeDoubleLines.Designer.cs
generated
@ -169,6 +169,9 @@
|
||||
this.SubtitleListview1.Name = "SubtitleListview1";
|
||||
this.SubtitleListview1.OwnerDraw = true;
|
||||
this.SubtitleListview1.Size = new System.Drawing.Size(1028, 429);
|
||||
this.SubtitleListview1.SubtitleFontBold = false;
|
||||
this.SubtitleListview1.SubtitleFontName = "Tahoma";
|
||||
this.SubtitleListview1.SubtitleFontSize = 8;
|
||||
this.SubtitleListview1.TabIndex = 40;
|
||||
this.SubtitleListview1.UseCompatibleStateImageBehavior = false;
|
||||
this.SubtitleListview1.UseSyntaxColoring = true;
|
||||
@ -187,6 +190,7 @@
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.KeyPreview = true;
|
||||
this.MinimumSize = new System.Drawing.Size(750, 400);
|
||||
this.Name = "MergeDoubleLines";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
|
30
src/Forms/MultipleReplace.Designer.cs
generated
30
src/Forms/MultipleReplace.Designer.cs
generated
@ -64,6 +64,8 @@
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
this.moveTopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.moveBottomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.groupBoxLinesFound.SuspendLayout();
|
||||
this.groupBoxReplaces.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
@ -331,29 +333,31 @@
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.deleteToolStripMenuItem,
|
||||
this.moveUpToolStripMenuItem,
|
||||
this.moveDownToolStripMenuItem});
|
||||
this.moveDownToolStripMenuItem,
|
||||
this.moveTopToolStripMenuItem,
|
||||
this.moveBottomToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(138, 70);
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(162, 136);
|
||||
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||
//
|
||||
// deleteToolStripMenuItem
|
||||
//
|
||||
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
|
||||
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
|
||||
this.deleteToolStripMenuItem.Text = "Delete";
|
||||
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItemClick);
|
||||
//
|
||||
// moveUpToolStripMenuItem
|
||||
//
|
||||
this.moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem";
|
||||
this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
|
||||
this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
|
||||
this.moveUpToolStripMenuItem.Text = "Move up";
|
||||
this.moveUpToolStripMenuItem.Click += new System.EventHandler(this.moveUpToolStripMenuItem_Click);
|
||||
//
|
||||
// moveDownToolStripMenuItem
|
||||
//
|
||||
this.moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem";
|
||||
this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
|
||||
this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
|
||||
this.moveDownToolStripMenuItem.Text = "Move down";
|
||||
this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click);
|
||||
//
|
||||
@ -417,6 +421,20 @@
|
||||
//
|
||||
this.openFileDialog1.FileName = "openFileDialog1";
|
||||
//
|
||||
// moveTopToolStripMenuItem
|
||||
//
|
||||
this.moveTopToolStripMenuItem.Name = "moveTopToolStripMenuItem";
|
||||
this.moveTopToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
|
||||
this.moveTopToolStripMenuItem.Text = "Move to top";
|
||||
this.moveTopToolStripMenuItem.Click += new System.EventHandler(this.moveTopToolStripMenuItem_Click);
|
||||
//
|
||||
// moveBottomToolStripMenuItem
|
||||
//
|
||||
this.moveBottomToolStripMenuItem.Name = "moveBottomToolStripMenuItem";
|
||||
this.moveBottomToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
|
||||
this.moveBottomToolStripMenuItem.Text = "Move to bottom";
|
||||
this.moveBottomToolStripMenuItem.Click += new System.EventHandler(this.moveBottomToolStripMenuItem_Click);
|
||||
//
|
||||
// MultipleReplace
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -482,5 +500,7 @@
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
||||
private System.Windows.Forms.Button buttonRemoveAll;
|
||||
private System.Windows.Forms.ToolStripMenuItem moveTopToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem moveBottomToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -104,7 +104,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (sender == radioButtonRegEx)
|
||||
textBoxFind.ContextMenu = FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind);
|
||||
else
|
||||
textBoxFind.ContextMenuStrip = null;
|
||||
textBoxFind.ContextMenu = null;
|
||||
}
|
||||
|
||||
private void ButtonAddClick(object sender, EventArgs e)
|
||||
@ -192,7 +192,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
newText = newText.Substring(0, index) + replaceWith;
|
||||
|
||||
hit = true;
|
||||
index = newText.ToLower().IndexOf(findWhat.ToLower(), index+replaceWith.Length);
|
||||
index = newText.ToLower().IndexOf(findWhat.ToLower(), index + replaceWith.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,6 +302,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void DeleteToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewReplaceList.Items.Count < 1 || listViewReplaceList.SelectedItems.Count < 1)
|
||||
return;
|
||||
for (int i = listViewReplaceList.Items.Count - 1; i >= 0; i--)
|
||||
{
|
||||
ListViewItem item = listViewReplaceList.Items[i];
|
||||
@ -322,6 +324,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
moveUpToolStripMenuItem_Click(sender, e);
|
||||
if (e.KeyCode == Keys.Down && e.Control && !e.Alt && !e.Shift)
|
||||
moveDownToolStripMenuItem_Click(sender, e);
|
||||
|
||||
if (e.KeyData == (Keys.Control | Keys.Home))
|
||||
moveTopToolStripMenuItem_Click(sender, e);
|
||||
else if (e.KeyData == (Keys.Control | Keys.End))
|
||||
moveBottomToolStripMenuItem_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,6 +418,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
moveUpToolStripMenuItem.Visible = listViewReplaceList.Items.Count > 1 && listViewReplaceList.SelectedItems.Count == 1;
|
||||
moveDownToolStripMenuItem.Visible = listViewReplaceList.Items.Count > 1 && listViewReplaceList.SelectedItems.Count == 1;
|
||||
moveTopToolStripMenuItem.Visible = listViewReplaceList.Items.Count > 1 && listViewReplaceList.SelectedItems.Count == 1;
|
||||
moveBottomToolStripMenuItem.Visible = listViewReplaceList.Items.Count > 1 && listViewReplaceList.SelectedItems.Count == 1;
|
||||
}
|
||||
|
||||
private void moveUpToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@ -453,6 +462,24 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SwapReplaceList(index, index + 1);
|
||||
}
|
||||
|
||||
|
||||
private void moveTopToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
int index = listViewReplaceList.SelectedIndices[0];
|
||||
if (index == 0)
|
||||
return;
|
||||
SwapReplaceList(index, 0);
|
||||
}
|
||||
|
||||
private void moveBottomToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
int index = listViewReplaceList.SelectedIndices[0];
|
||||
int bottomIndex = listViewReplaceList.Items.Count - 1;
|
||||
if (index == bottomIndex)
|
||||
return;
|
||||
SwapReplaceList(index, bottomIndex);
|
||||
}
|
||||
|
||||
private void ExportClick(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewReplaceList.Items.Count == 0)
|
||||
@ -501,6 +528,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
foreach (XmlNode listNode in doc.DocumentElement.SelectNodes("MultipleSearchAndReplaceList/MultipleSearchAndReplaceItem"))
|
||||
{
|
||||
MultipleSearchAndReplaceSetting item = new MultipleSearchAndReplaceSetting();
|
||||
@ -519,10 +547,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Configuration.Settings.MultipleSearchAndReplaceList.Add(item);
|
||||
}
|
||||
|
||||
listViewReplaceList.BeginUpdate();
|
||||
listViewReplaceList.Items.Clear();
|
||||
foreach (var item in Configuration.Settings.MultipleSearchAndReplaceList)
|
||||
AddToReplaceListView(item.Enabled, item.FindWhat, item.ReplaceWith, EnglishSearchTypeToLocal(item.SearchType));
|
||||
GeneratePreview();
|
||||
listViewReplaceList.EndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -534,7 +564,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void MultipleReplace_Shown(object sender, EventArgs e)
|
||||
{
|
||||
listViewReplaceList.ItemChecked +=ListViewReplaceListItemChecked;
|
||||
listViewReplaceList.ItemChecked += ListViewReplaceListItemChecked;
|
||||
GeneratePreview();
|
||||
}
|
||||
|
||||
@ -547,7 +577,5 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -158,9 +158,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
cm.MenuItems.Add("Any character (.)", delegate { textBox.SelectedText = "."; });
|
||||
cm.MenuItems.Add("Any whitespace", delegate { textBox.SelectedText = "\\s"; });
|
||||
cm.MenuItems.Add("Zero or more (*)", delegate { textBox.SelectedText = "*"; });
|
||||
cm.MenuItems.Add("One or more", delegate { textBox.SelectedText = "+"; });
|
||||
cm.MenuItems.Add("In character goup ([test])", delegate { textBox.SelectedText = "[test]"; });
|
||||
cm.MenuItems.Add("Not in character goup ([^test])", delegate { textBox.SelectedText = "[^test]"; });
|
||||
cm.MenuItems.Add("One or more (+)", delegate { textBox.SelectedText = "+"; });
|
||||
cm.MenuItems.Add("In character group ([test])", delegate { textBox.SelectedText = "[test]"; });
|
||||
cm.MenuItems.Add("Not in character group ([^test])", delegate { textBox.SelectedText = "[^test]"; });
|
||||
return cm;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user