Inheritance: IComparable
Exemplo n.º 1
0
	public SyncPoint (int subtitleNumber, Timing current, Timing correct) {
		this.subtitleNumber = subtitleNumber;
		this.current = current;
		this.correct = correct;
	}
	private void OnAdd (object o, EventArgs args) {
		/* Check if document and video are loaded */
		if (!(Base.IsDocumentLoaded && Base.Ui.Video.IsLoaded))
			return;

		/* Get selected subtitle */
		TreePath path = Base.Ui.View.Selection.Path;
		if (path == null)
			return;

		int subtitleNumber = Core.Util.PathToInt(path);
		Subtitle subtitle = Base.Ui.View.Selection.Subtitle;

		/* Get current start */
		Timing currentTiming = new Timing(subtitle.Frames.Start, subtitle.Times.Start);

		/* Get correct start from video */
		Timing correctTiming = new Timing(Base.Ui.Video.Position.CurrentFrames, Base.Ui.Video.Position.CurrentTime);

		/* Create and add the sync point */
		SyncPoint syncPoint = new SyncPoint(subtitleNumber, currentTiming, correctTiming);
		int syncPointIndex = syncPoints.Add(syncPoint);
		TreePath syncPointPath = Core.Util.IntToPath(syncPointIndex);
		SelectPath(syncPointPath);

		UpdateFromSyncPointCountChanged();
	}