/// <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, TreePath[] paths, bool setPaths) : base(description, canGroup) {
		if (setPaths) {
			switch (selectionIntended) {
				case SelectionIntended.Simple:
					this.paths = (paths != null ? paths : Base.Ui.View.Selection.Paths);
					this.focus = Base.Ui.View.Selection.Focus;
					break;
				case SelectionIntended.Range:
					this.paths = (paths != null ? paths : Base.Ui.View.Selection.Range);
					this.focus = Base.Ui.View.Selection.Focus;
					break;
				case SelectionIntended.SimpleToFirst:
					this.paths = (paths != null ? paths : Base.Ui.View.Selection.PathsToFirst);
					this.focus = Base.Ui.View.Selection.Focus;
					break;
				case SelectionIntended.SimpleToLast:
					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;
			}
		}

		this.selectionType = GetSelectionType(selectionIntended);
	}
        protected override bool ProcessResponse(ResponseType response)
        {
            if (response == ResponseType.Ok)
            {
                if (spinButton.ValueAsInt != 0)
                {
                    SelectionIntended selectionIntended = GetSelectionIntended();

                    if (timingMode == TimingMode.Times)
                    {
                        TimeSpan time = TimeSpan.FromMilliseconds(spinButton.Value);
                        Base.CommandManager.Execute(new ShiftTimingsCommand(time, selectionIntended));
                    }
                    else
                    {
                        int frames = (int)spinButton.Value;
                        Base.CommandManager.Execute(new ShiftTimingsCommand(frames, selectionIntended));
                    }
                }

                return(true);
            }

            return(false);
        }
        /// <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, TreePath[] paths, bool setPaths) : base(description, canGroup)
        {
            if (setPaths)
            {
                switch (selectionIntended)
                {
                case SelectionIntended.Simple:
                    this.paths = (paths != null ? paths : Base.Ui.View.Selection.Paths);
                    this.focus = Base.Ui.View.Selection.Focus;
                    break;

                case SelectionIntended.Range:
                    this.paths = (paths != null ? paths : Base.Ui.View.Selection.Range);
                    this.focus = Base.Ui.View.Selection.Focus;
                    break;

                case SelectionIntended.SimpleToFirst:
                    this.paths = (paths != null ? paths : Base.Ui.View.Selection.PathsToFirst);
                    this.focus = Base.Ui.View.Selection.Focus;
                    break;

                case SelectionIntended.SimpleToLast:
                    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;
                }
            }

            this.selectionType = GetSelectionType(selectionIntended);
        }
        /* Private methods */

        private SelectionType GetSelectionType(SelectionIntended selectionIntended)
        {
            switch (selectionIntended)
            {
            case SelectionIntended.All:
                return(SelectionType.All);

            case SelectionIntended.Simple:
                return(SelectionType.Simple);

            case SelectionIntended.SimpleToFirst:
                return(SelectionType.Range);

            case SelectionIntended.SimpleToLast:
                return(SelectionType.Range);

            case SelectionIntended.Range:
                return(SelectionType.Range);

            default:
                return(SelectionType.Simple);
            }
        }
Esempio n. 5
0
        protected override bool ProcessResponse(ResponseType response)
        {
            if (response == ResponseType.Ok)
            {
                SelectionIntended selectionIntended = GetSelectionIntended();

                if (timingMode == TimingMode.Times)
                {
                    TimeSpan firstTime = TimeSpan.Parse(firstSubtitleNewStartSpinButton.Text);
                    TimeSpan lastTime  = TimeSpan.Parse(lastSubtitleNewStartSpinButton.Text);
                    Base.CommandManager.Execute(new AdjustTimingsCommand(firstTime, lastTime, selectionIntended));
                }
                else
                {
                    int firstFrame = (int)firstSubtitleNewStartSpinButton.Value;
                    int lastFrame  = (int)lastSubtitleNewStartSpinButton.Value;
                    Base.CommandManager.Execute(new AdjustTimingsCommand(firstFrame, lastFrame, selectionIntended));
                }

                return(true);
            }

            return(false);
        }
Esempio n. 6
0
        protected override bool ProcessResponse(ResponseType response)
        {
            if (response == ResponseType.Ok)
            {
                if (CanSynchronize())
                {
                    bool toSyncAll = allSubtitlesRadioButton.Active;
                    SelectionIntended selectionIntended = (toSyncAll ? SelectionIntended.All : SelectionIntended.Range);

                    TreePath[] pathRange = null;
                    if (selectionIntended == SelectionIntended.Range)
                    {
                        pathRange    = new TreePath[2];
                        pathRange[0] = Core.Util.IntToPath(syncPoints.Collection[0].SubtitleNumber);
                        pathRange[1] = Core.Util.IntToPath(syncPoints.Collection[syncPoints.Collection.Count - 1].SubtitleNumber);
                    }

                    Base.CommandManager.Execute(new SynchronizeTimingsCommand(syncPoints, toSyncAll, selectionIntended, pathRange));
                }
                return(true);
            }

            return(false);
        }
Esempio n. 7
0
 public AdjustTimingsCommand(TimeSpan firstTime, TimeSpan lastTime, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true)
 {
     this.firstTime = firstTime;
     this.lastTime  = lastTime;
     useTimes       = true;
 }
 public SynchronizeTimingsCommand(SyncPoints syncPoints, bool toSyncAll, SelectionIntended selectionIntended, TreePath[] pathRange) : base(description, false, selectionIntended, pathRange, true)
 {
     this.syncPoints = syncPoints;
     this.toSyncAll  = toSyncAll;
 }
	public AdjustTimingsCommand (int firstFrame, int lastFrame, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true) {
		this.firstFrame = firstFrame;
		this.lastFrame = lastFrame;
		useTimes = false;
	}
	public AdjustTimingsCommand (TimeSpan firstTime, TimeSpan lastTime, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true) {
		this.firstTime = firstTime;
		this.lastTime = lastTime;
		useTimes = true;
	}
 /// <summary>Creates a new instance of the <see cref="MultipleFixedSelectionCommand" /> class.</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.</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, TreePath[] paths, bool reselect) : base(description, canGroup, selectionIntended, paths)
 {
     this.reselect = reselect;
 }
Esempio n. 12
0
	public ShiftTimingsCommand (int frames, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true) {
		this.frames = frames;
		useTimes = false;
	}
Esempio n. 13
0
	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, null, true)
 {
     this.frames = frames;
     useTimes    = false;
 }
 public ShiftTimingsCommand(TimeSpan time, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true)
 {
     this.time = time;
     useTimes  = true;
 }
Esempio n. 16
0
 public AdjustTimingsCommand(int firstFrame, int lastFrame, SelectionIntended selectionIntended) : base(description, false, selectionIntended, null, true)
 {
     this.firstFrame = firstFrame;
     this.lastFrame  = lastFrame;
     useTimes        = false;
 }
	/// <summary>Creates a new instance of the <see cref="MultipleFixedSelectionCommand" /> class.</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.</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, TreePath[] paths, bool reselect) : base(description, canGroup, selectionIntended, paths) {
		this.reselect = reselect;
	}
 public MultipleSelectionCommand(string description, bool canGroup, SelectionIntended selectionIntended, TreePath[] paths) : this(description, canGroup, selectionIntended, paths, true)
 {
 }
	public MultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended, TreePath[] paths) : this(description, canGroup, selectionIntended, paths, true) {
	}
	/* Private methods */

	private SelectionType GetSelectionType (SelectionIntended selectionIntended) {
		switch (selectionIntended) {
			case SelectionIntended.All:
				return SelectionType.All;
			case SelectionIntended.Simple:
				return SelectionType.Simple;
			case SelectionIntended.SimpleToFirst:
				return SelectionType.Range;
			case SelectionIntended.SimpleToLast:
				return SelectionType.Range;
			case SelectionIntended.Range:
				return SelectionType.Range;
			default:
				return SelectionType.Simple;
		}
	}