[gnome-subtitles] Allow to clear the text.



commit 9a1d90f6cf70f26232795d3e12e59bfabdede837
Author: Pedro Castro <mail pedrocastro org>
Date:   Sun Jun 12 23:30:53 2011 +0100

    Allow to clear the text.

 src/SubLib/Core/Domain/SubtitleText.cs |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/SubLib/Core/Domain/SubtitleText.cs b/src/SubLib/Core/Domain/SubtitleText.cs
index 7bcb0e1..a3e9c97 100644
--- a/src/SubLib/Core/Domain/SubtitleText.cs
+++ b/src/SubLib/Core/Domain/SubtitleText.cs
@@ -63,6 +63,10 @@ public class SubtitleText : ICloneable {
 
 	
 	/* Public methods */
+	
+	public void Clear () {
+		lines.Clear();
+	}
 
 	/// <summary>Gets the specified text line.</summary>
 	/// <param name="index">The zero-based line number index.</param>
@@ -173,7 +177,7 @@ public class SubtitleText : ICloneable {
 		string spaceDelimiter = (toTrimLines ? @"\s*" : String.Empty);
 		string regexPattern = spaceDelimiter + @escapedLineBreak + spaceDelimiter;
 		string[] textLines = Regex.Split(text, regexPattern);
-		lines.Clear();
+		Clear();
 		foreach (string textLine in textLines)
 			lines.Add(textLine);
 	}
@@ -185,6 +189,11 @@ public class SubtitleText : ICloneable {
 		Set(text, "\n", false);
 	}
 	
+	public void Set (string[] newLines) {
+		Clear();
+		Add(newLines);
+	}
+	
 	public void Add (string[] newLines) {
 		foreach (string newLine in newLines) {
 			string trimmedLine = newLine.Trim();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]