[gnome-subtitles] Allow to redraw a set of paths. Allow to insert a set of subtitles.



commit 210892f71e934b677901b1ed5254838acbe27abd
Author: Pedro Castro <mail pedrocastro org>
Date:   Sun Jun 12 23:30:43 2011 +0100

    Allow to redraw a set of paths.
    Allow to insert a set of subtitles.

 src/GnomeSubtitles/Ui/View/SubtitleView.cs |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/GnomeSubtitles/Ui/View/SubtitleView.cs b/src/GnomeSubtitles/Ui/View/SubtitleView.cs
index 4a2df0a..afa9685 100644
--- a/src/GnomeSubtitles/Ui/View/SubtitleView.cs
+++ b/src/GnomeSubtitles/Ui/View/SubtitleView.cs
@@ -84,6 +84,11 @@ public class SubtitleView {
 	public void RedrawPath (TreePath path) {
 		subtitles.Model.EmitRowChanged(path, TreeIter.Zero);
 	}
+	
+	public void RedrawPaths (TreePath[] paths) {
+		foreach (TreePath path in paths)
+			RedrawPath(path);
+	}
 
 	/// <summary>Refreshes the view.</summary>
 	/// <remarks>This is currently limited to a <see cref="TreeView.QueueDraw()" />.</remarks>
@@ -168,6 +173,16 @@ public class SubtitleView {
 		selection.Select(paths, focus, true);
 	}
 	
+	public void Insert (Subtitle[] subtitles, TreePath firstPath, TreePath focus) {
+		for (int index = 0, pathIndex = Util.PathToInt(firstPath) ; index < subtitles.Length  ; index++, pathIndex++) {
+			Subtitle subtitle = subtitles[index];
+			this.subtitles.Add(subtitle, pathIndex);		
+		}
+		TreePath lastPath = Util.IntToPath(Util.PathToInt(firstPath) + subtitles.Length - 1);
+		TreePath[] pathRange = new TreePath[]{firstPath, lastPath};
+		selection.SelectRange(pathRange, focus, true);
+	}
+	
 	/// <summary>Removes the subtitle at the specified path and selects the next or previous subtitle afterwards.</summary>
 	/// <param name="path">The path to remove.</param>
 	/// <param name="selectNext">Whether to select the next path after deletion, if possible.



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