[gnome-subtitles] Commands now accept a list of paths if they're to be specified
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-subtitles] Commands now accept a list of paths if they're to be specified
- Date: Sat, 23 May 2009 07:43:59 -0400 (EDT)
commit 68283a2e54a5d47e1ce5948625e8b8ea19b08fd7
Author: Pedro Castro <mail pedrocastro org>
Date: Sat May 23 12:39:30 2009 +0100
Commands now accept a list of paths if they're to be specified
---
.../Core/Command/AdjustTimingsCommand.cs | 6 +++---
.../Core/Command/ChangeFrameRateCommand.cs | 4 ++--
.../Core/Command/ChangeStyleCommand.cs | 4 ++--
.../Core/Command/DeleteSubtitlesCommand.cs | 4 ++--
.../Core/Command/FixedMultipleSelectionCommand.cs | 3 ++-
.../Core/Command/MultipleSelectionCommand.cs | 20 +++++++++++++-------
.../Core/Command/ReplaceAllCommand.cs | 4 ++--
.../Core/Command/ShiftTimingsCommand.cs | 6 +++---
8 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs b/src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs
index 56c5e59..60e78d3 100644
--- a/src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs
+++ b/src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2008 Pedro Castro
+ * Copyright (C) 2006-2009 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,13 +30,13 @@ public class AdjustTimingsCommand : FixedMultipleSelectionCommand {
private int firstFrame, lastFrame;
private bool useTimes = true;
- public AdjustTimingsCommand (TimeSpan firstTime, TimeSpan lastTime, SelectionIntended selectionIntended) : base(description, false, selectionIntended, true) {
+ public AdjustTimingsCommand (TimeSpan firstTime, TimeSpan lastTime, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true) {
this.firstTime = firstTime;
this.lastTime = lastTime;
useTimes = true;
}
- public AdjustTimingsCommand (int firstFrame, int lastFrame, SelectionIntended selectionIntended) : base(description, false, selectionIntended, true) {
+ public AdjustTimingsCommand (int firstFrame, int lastFrame, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true) {
this.firstFrame = firstFrame;
this.lastFrame = lastFrame;
useTimes = false;
diff --git a/src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs b/src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs
index 49ee055..f426443 100644
--- a/src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs
+++ b/src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2008 Pedro Castro
+ * Copyright (C) 2006-2009 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ namespace GnomeSubtitles.Core.Command {
public abstract class ChangeFrameRateCommand : FixedMultipleSelectionCommand {
private float storedFrameRate = 0;
- public ChangeFrameRateCommand (string description, float frameRate) : base(description, false, SelectionIntended.All, true) {
+ public ChangeFrameRateCommand (string description, float frameRate) : base(description, false, SelectionIntended.All, null, true) {
this.storedFrameRate = frameRate;
}
diff --git a/src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs b/src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs
index eaaef7f..21ed53b 100644
--- a/src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs
+++ b/src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2008 Pedro Castro
+ * Copyright (C) 2006-2009 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ namespace GnomeSubtitles.Core.Command {
public abstract class ChangeStyleCommand : FixedMultipleSelectionCommand {
private bool styleValue;
- public ChangeStyleCommand (string description, bool newStyleValue) : base(description, false, SelectionIntended.Simple, true) {
+ public ChangeStyleCommand (string description, bool newStyleValue) : base(description, false, SelectionIntended.Simple, null, true) {
this.styleValue = newStyleValue;
}
diff --git a/src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs b/src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs
index d27e1cf..3ac51db 100644
--- a/src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs
+++ b/src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2008 Pedro Castro
+ * Copyright (C) 2006-2009 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ public class DeleteSubtitlesCommand : MultipleSelectionCommand {
private static string description = Catalog.GetString("Deleting Subtitles");
private Subtitle[] subtitles = null;
- public DeleteSubtitlesCommand () : base(description, false, SelectionIntended.Simple) {
+ public DeleteSubtitlesCommand () : base(description, false, SelectionIntended.Simple, null) {
StoreSubtitles();
}
diff --git a/src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs b/src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs
index 181771b..43d9225 100644
--- a/src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs
+++ b/src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs
@@ -30,8 +30,9 @@ public abstract class FixedMultipleSelectionCommand : MultipleSelectionCommand {
/// <param name="description">The description of the command.</param>
/// <param name="canGroup">Whether to possibly group the command with the previous command.</param>
/// <param name="selectionIntended">The intended selection.</param>
+ /// <param name="paths">The paths to select, or null to use auto selection.</param>
/// <param name="reselect">Whether to reselect the command when executing. Note that this doesn't apply to Undo nor to Redo.</param>
- public FixedMultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended, bool reselect) : base(description, canGroup, selectionIntended) {
+ public FixedMultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended, TreePath[] paths, bool reselect) : base(description, canGroup, selectionIntended, paths) {
this.reselect = reselect;
}
diff --git a/src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs b/src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs
index 20612b7..302f3a4 100644
--- a/src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs
+++ b/src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2008 Pedro Castro
+ * Copyright (C) 2006-2009 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,33 +28,39 @@ public abstract class MultipleSelectionCommand : Command {
private SelectionType selectionType;
- public MultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended) : this(description, canGroup, selectionIntended, true) {
+ public MultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended, TreePath[] paths) : this(description, canGroup, selectionIntended, paths, true) {
}
/// <summary>Base constructor for classes that inherit <see cref="MultipleSelectionCommand" />.</summary>
/// <param name="description">The description of the command.</param>
/// <param name="canGroup">Whether to possibly group the command with the previous command.</param>
/// <param name="selectionIntended">The intended selection.</param>
+ /// <param name="paths">The paths to select, or null to use auto selection if setPaths is enabled.</param>
/// <param name="setPaths">Whether to set the paths based on the current selection and the selectionType</param>
- public MultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended, bool setPaths) : base(description, canGroup) {
+ public MultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended, TreePath[] paths, bool setPaths) : base(description, canGroup) {
if (setPaths) {
switch (selectionIntended) {
case SelectionIntended.Simple:
- this.paths = Base.Ui.View.Selection.Paths;
+ this.paths = (paths != null ? paths : Base.Ui.View.Selection.Paths);
this.focus = Base.Ui.View.Selection.Focus;
break;
case SelectionIntended.Range:
- this.paths = Base.Ui.View.Selection.Range;
+ this.paths = (paths != null ? paths : Base.Ui.View.Selection.Range);
this.focus = Base.Ui.View.Selection.Focus;
break;
case SelectionIntended.SimpleToFirst:
- this.paths = Base.Ui.View.Selection.PathsToFirst;
+ this.paths = (paths != null ? paths : Base.Ui.View.Selection.PathsToFirst);
this.focus = Base.Ui.View.Selection.Focus;
break;
case SelectionIntended.SimpleToLast:
- this.paths = Base.Ui.View.Selection.PathsToLast;
+ this.paths = (paths != null ? paths : Base.Ui.View.Selection.PathsToLast);
this.focus = Base.Ui.View.Selection.Focus;
break;
+ default:
+ if (paths != null)
+ this.paths = paths;
+
+ break;
}
}
diff --git a/src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs b/src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs
index ef4e620..524ecf2 100644
--- a/src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs
+++ b/src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2008 Pedro Castro
+ * Copyright (C) 2006-2009 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ public class ReplaceAllCommand : MultipleSelectionCommand {
private Regex regex = null;
private string replacement = String.Empty;
- public ReplaceAllCommand (Regex regex, string replacement) : base(description, false, SelectionIntended.Simple, false) {
+ public ReplaceAllCommand (Regex regex, string replacement) : base(description, false, SelectionIntended.Simple, null, false) {
this.regex = regex;
this.replacement = replacement;
}
diff --git a/src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs b/src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs
index 26699a0..1fa845b 100644
--- a/src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs
+++ b/src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2008 Pedro Castro
+ * Copyright (C) 2006-2009 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,12 +32,12 @@ public class ShiftTimingsCommand : FixedMultipleSelectionCommand {
private int frames;
private bool useTimes = true;
- public ShiftTimingsCommand (TimeSpan time, SelectionIntended selectionIntended) : base(description, false, selectionIntended, true) {
+ public ShiftTimingsCommand (TimeSpan time, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true) {
this.time = time;
useTimes = true;
}
- public ShiftTimingsCommand (int frames, SelectionIntended selectionIntended) : base(description, false, selectionIntended, true) {
+ public ShiftTimingsCommand (int frames, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true) {
this.frames = frames;
useTimes = false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]