Some search&replace improvements - thx Adem :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1258 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-06-17 15:22:44 +00:00
parent 39d475ef92
commit e69bbbbc19
5 changed files with 65 additions and 11 deletions

View File

@ -288,6 +288,9 @@ namespace Nikse.SubtitleEdit.Forms
toolStripButtonGetFrameRate.Visible = true;
}
_timerClearStatus.Interval = Configuration.Settings.General.ClearStatusBarAfterSeconds * 1000;
_timerClearStatus.Tick += TimerClearStatus_Tick;
string fileName = string.Empty;
string[] args = Environment.GetCommandLineArgs();
if (args.Length >= 4 && args[1].ToLower() == "/convert")
@ -374,9 +377,6 @@ namespace Nikse.SubtitleEdit.Forms
toolStripComboBoxWaveForm.SelectedIndexChanged += toolStripComboBoxWaveForm_SelectedIndexChanged;
FixLargeFonts();
_timerClearStatus.Interval = 5000;
_timerClearStatus.Tick += TimerClearStatus_Tick;
}
catch (Exception exception)
{
@ -3109,6 +3109,7 @@ namespace Nikse.SubtitleEdit.Forms
if (findDialog.ShowDialog(this) == DialogResult.OK)
{
_findHelper = findDialog.GetFindDialogHelper(_subtitleListViewIndex);
ShowStatus(string.Format(_language.SearchingForXFromLineY, _findHelper.FindText, _subtitleListViewIndex +1));
if (tabControlSubtitle.SelectedIndex == TabControlListView)
{
int selectedIndex = -1;
@ -3281,6 +3282,7 @@ namespace Nikse.SubtitleEdit.Forms
if (replaceDialog.ShowDialog(this) == DialogResult.OK)
{
_findHelper = replaceDialog.GetFindDialogHelper(_subtitleListViewIndex);
ShowStatus(string.Format(_language.SearchingForXFromLineY, _findHelper.FindText, _subtitleListViewIndex + 1));
int replaceCount = 0;
bool searchStringFound = true;
while (searchStringFound)
@ -3381,23 +3383,34 @@ namespace Nikse.SubtitleEdit.Forms
_findHelper.SelectedPosition = pos;
_findHelper.Success = success;
}
ShowStatus(string.Format(_language.SearchingForXFromLineY, _findHelper.FindText, _subtitleListViewIndex + 1));
int replaceCount = 0;
bool searchStringFound = true;
int firstIndex = FirstSelectedIndex;
while (searchStringFound)
{
{
searchStringFound = false;
if (isFirst)
{
MakeHistoryForUndo(string.Format(_language.BeforeReplace, _findHelper.FindText));
isFirst = false;
_makeHistoryPaused = true;
_makeHistoryPaused = true;
}
if (replaceDialog.ReplaceAll)
{
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition, Configuration.Settings.General.AllowEditOfOriginalSubtitle))
{
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
textBoxListViewText.Visible = false;
_subtitleListViewIndex = _findHelper.SelectedIndex;
textBoxListViewText.Text = _subtitle.Paragraphs[_findHelper.SelectedIndex].Text;
if (_subtitleAlternate != null && textBoxListViewTextAlternate.Visible)
{
var orginial = Utilities.GetOriginalParagraph(_findHelper.SelectedIndex, _subtitle.Paragraphs[_findHelper.SelectedIndex], _subtitleAlternate.Paragraphs);
if (orginial != null)
textBoxListViewTextAlternate.Text = orginial.Text;
}
if (_findHelper.MatchInOriginal)
{
textBoxListViewTextAlternate.SelectionStart = _findHelper.SelectedPosition;
@ -3416,6 +3429,9 @@ namespace Nikse.SubtitleEdit.Forms
}
else
{
textBoxListViewText.Visible = true;
_subtitleListViewIndex = -1;
SubtitleListview1.SelectIndexAndEnsureVisible(firstIndex, true);
ShowStatus(string.Format(_language.NoMatchFoundX, _findHelper.FindText));
if (_replaceStartLineIndex >= 1) // Prompt for start over
@ -3446,7 +3462,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition, Configuration.Settings.General.AllowEditOfOriginalSubtitle))
{
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex, true);
textBoxListViewText.Focus();
textBoxListViewText.SelectionStart = _findHelper.SelectedPosition;
textBoxListViewText.SelectionLength = _findHelper.FindTextLength;
@ -3533,7 +3549,7 @@ namespace Nikse.SubtitleEdit.Forms
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition, Configuration.Settings.General.AllowEditOfOriginalSubtitle))
{
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex, true);
textBoxListViewText.Focus();
textBoxListViewText.SelectionStart = _findHelper.SelectedPosition;
textBoxListViewText.SelectionLength = _findHelper.FindTextLength;
@ -10421,7 +10437,25 @@ namespace Nikse.SubtitleEdit.Forms
{
TimeCode tc = new TimeCode(TimeSpan.FromMilliseconds(adjustMilliseconds));
MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater + ": " + tc.ToString());
if (adjustMilliseconds < 0)
{
if (selection == SelectionChoice.AllLines)
ShowStatus(string.Format(_language.ShowAllLinesXSecondsLinesEarlier, adjustMilliseconds / -1000.0));
else if (selection == SelectionChoice.SelectionOnly)
ShowStatus(string.Format(_language.ShowSelectedLinesXSecondsLinesEarlier, adjustMilliseconds / -1000.0));
else if (selection == SelectionChoice.SelectionAndForward)
ShowStatus(string.Format(_language.ShowSelectionAndForwardXSecondsLinesEarlier, adjustMilliseconds / -1000.0));
}
else
{
if (selection == SelectionChoice.AllLines)
ShowStatus(string.Format(_language.ShowAllLinesXSecondsLinesLater, adjustMilliseconds / 1000.0));
else if (selection == SelectionChoice.SelectionOnly)
ShowStatus(string.Format(_language.ShowSelectedLinesXSecondsLinesLater, adjustMilliseconds / 1000.0));
else if (selection == SelectionChoice.SelectionAndForward)
ShowStatus(string.Format(_language.ShowSelectionAndForwardXSecondsLinesLater, adjustMilliseconds / 1000.0));
}
double frameRate = CurrentFrameRate;
SubtitleListview1.BeginUpdate();

View File

@ -681,7 +681,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAZgBFAGYARQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAagBFAGoARQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -619,6 +619,7 @@ namespace Nikse.SubtitleEdit.Logic
FindContinueTitle = "Continue Find?",
FindContinue = "The search item was not found." + Environment.NewLine +
"Would you like to start from the top of the document and search one more time?",
SearchingForXFromLineY = "Searching for '{0}' from line number {1}...",
XFoundAtLineNumberY = "'{0}' found at line number {1}",
XNotFound = "'{0}' not found",
BeforeReplace = "Before replace: {0}",
@ -731,6 +732,12 @@ namespace Nikse.SubtitleEdit.Logic
BeforeImportingBluRaySupFile = "Before importing Blu-ray sup file",
BeforeImportingBdnXml = "Before importing BDN xml file",
BeforeShowSelectedLinesEarlierLater = "Before show selected lines earlier/later",
ShowAllLinesXSecondsLinesEarlier = "Show all lines {0:0.0##} seconds earlier",
ShowAllLinesXSecondsLinesLater = "Show all lines {0:0.0##} seconds later",
ShowSelectedLinesXSecondsLinesEarlier = "Show selected lines {0:0.0##} seconds earlier",
ShowSelectedLinesXSecondsLinesLater = "Show selected lines {0:0.0##} seconds later",
ShowSelectionAndForwardXSecondsLinesEarlier = "Show selection and forward {0:0.0##} seconds earlier",
ShowSelectionAndForwardXSecondsLinesLater = "Show selection and forward {0:0.0##} seconds later",
ShowSelectedLinesEarlierLaterPerformed = "Show earlier/later performed on selected lines",
DoubleWordsViaRegEx = "Double words via regex {0}",
BeforeSortX = "Before sort: {0}",

View File

@ -562,6 +562,7 @@
public string NewFrameRateUsedToCalculateFrameNumbers { get; set; }
public string FindContinue { get; set; }
public string FindContinueTitle { get; set; }
public string SearchingForXFromLineY { get; set; }
public string XFoundAtLineNumberY { get; set; }
public string XNotFound { get; set; }
public string BeforeReplace { get; set; }
@ -671,6 +672,12 @@
public string BeforeImportingBluRaySupFile { get; set; }
public string BeforeImportingBdnXml { get; set; }
public string BeforeShowSelectedLinesEarlierLater { get; set; }
public string ShowAllLinesXSecondsLinesEarlier { get; set; }
public string ShowAllLinesXSecondsLinesLater { get; set; }
public string ShowSelectedLinesXSecondsLinesEarlier { get; set; }
public string ShowSelectedLinesXSecondsLinesLater { get; set; }
public string ShowSelectionAndForwardXSecondsLinesEarlier { get; set; }
public string ShowSelectionAndForwardXSecondsLinesLater { get; set; }
public string ShowSelectedLinesEarlierLaterPerformed { get; set; }
public string DoubleWordsViaRegEx { get; set; }
public string BeforeSortX { get; set; }

View File

@ -323,6 +323,7 @@ namespace Nikse.SubtitleEdit.Logic
public int ListViewTextWidth { get; set; }
public string VlcWaveTranscodeSettings { get; set; }
public bool UseTimeFormatHHMMSSFF { get; set; }
public int ClearStatusBarAfterSeconds { get; set; }
public bool ShowBetaStuff { get; set; }
public GeneralSettings()
@ -373,7 +374,7 @@ namespace Nikse.SubtitleEdit.Logic
VideoPlayerShowStopButton = true;
ListViewLineSeparatorString = "<br />";
ListViewDoubleClickAction = 1;
UppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWZYXÆØÃÅÄÖÉÈÁÂÀÇÉÊÍÓÔÕÚŁАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯوهنملكقفغعظطضصشسزرذدخحجثتبأآأؤإئابةتثجحخدذرزسشصضطظعغػؼؽؾؿـفقكلمنهوىيٯٰٱٲٳٴٵٶٷٸٹٺٻټٽپٿڀځڂڃڄڅچڇڈډڊڋڌڍڎڏڐڑڒړڔڕږڗژڙښڛڜڝڞڟڠڡڢڣڤڥڦڧڨکڪګڬڭڮگڰڱڲڳڴڵڶڷڸڹںڻڼڽھڿۀہۂۃۄۅۆۇۈۉۊۋیۍێۏېۑےۓกขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ";
UppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWZYXÆØÃÅÄÖÉÈÁÂÀÇÉÊÍÓÔÕÚŁАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯĞİŞÜ";
DefaultAdjustMilliseconds = 1000;
AutoRepeatOn = true;
AutoContinueOn = false;
@ -392,6 +393,7 @@ namespace Nikse.SubtitleEdit.Logic
ListViewColumsRememberSize = true;
VlcWaveTranscodeSettings = "acodec=s16l"; // "acodec=s16l,channels=1,ab=64,samplerate=8000";
UseTimeFormatHHMMSSFF = false;
ClearStatusBarAfterSeconds = 10;
ShowBetaStuff = false;
}
}
@ -1030,6 +1032,9 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("UseTimeFormatHHMMSSFF");
if (subNode != null)
settings.General.UseTimeFormatHHMMSSFF = Convert.ToBoolean(subNode.InnerText.Trim());
subNode = node.SelectSingleNode("ClearStatusBarAfterSeconds");
if (subNode != null)
settings.General.ClearStatusBarAfterSeconds = Convert.ToInt32(subNode.InnerText.Trim());
subNode = node.SelectSingleNode("ShowBetaStuff");
if (subNode != null)
settings.General.ShowBetaStuff = Convert.ToBoolean(subNode.InnerText.Trim());
@ -1750,6 +1755,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("ListViewTextWidth", settings.General.ListViewTextWidth.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("VlcWaveTranscodeSettings", settings.General.VlcWaveTranscodeSettings);
textWriter.WriteElementString("UseTimeFormatHHMMSSFF", settings.General.UseTimeFormatHHMMSSFF.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ClearStatusBarAfterSeconds", settings.General.ClearStatusBarAfterSeconds.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ShowBetaStuff", settings.General.ShowBetaStuff.ToString());