public bool Add(SyncPoint syncPoint) { bool willReplace = Contains(syncPoint.SubtitleNumber); syncPoints[syncPoint.SubtitleNumber] = syncPoint; return(willReplace); }
/* Public methods */ public int Add (SyncPoint syncPoint) { bool didReplace = collection.Add(syncPoint); int index = collection.IndexOf(syncPoint); if (didReplace) { Replace(index, syncPoint); //Replace existing return index; } else if (collection[collection.Count - 1].SubtitleNumber == syncPoint.SubtitleNumber) { Append(syncPoint); //Append to the end return collection.Count - 1; } else { Insert(index, syncPoint); //Insert in position, not replacing return index; } }
public int CompareCurrentTo (SyncPoint otherSyncPoint) { return current.CompareTo(otherSyncPoint.Current); }
public int IndexOf(SyncPoint syncPoint) { return(syncPoints.IndexOfKey(syncPoint.SubtitleNumber)); }
private void Insert (int index, SyncPoint syncPoint) { model.SetValue(model.Insert(index), 0, syncPoint); }
private void Append (SyncPoint syncPoint) { model.AppendValues(syncPoint); }
private void Replace (int index, SyncPoint syncPoint) { TreeIter iter; model.GetIterFromString(out iter, index.ToString()); model.SetValue(iter, 0, syncPoint); }
public static bool Sync (Subtitles subtitles, SyncPoint start, SyncPoint end, bool syncLast) { return Sync(subtitles, start.SubtitleNumber, start.Correct.Time, end.SubtitleNumber, end.Correct.Time, syncLast); }
public static bool AreSyncPointsValid (Subtitles subtitles, SyncPoint start, SyncPoint end) { return AreSyncArgsValid(subtitles, start.SubtitleNumber, start.Correct.Time, end.SubtitleNumber, end.Correct.Time) && AreSyncArgsValid(subtitles, start.SubtitleNumber, start.Correct.Frame, end.SubtitleNumber, end.Correct.Frame); }
public bool Add (SyncPoint syncPoint) { bool willReplace = Contains(syncPoint.SubtitleNumber); syncPoints[syncPoint.SubtitleNumber] = syncPoint; return willReplace; }
public int IndexOf (SyncPoint syncPoint) { return syncPoints.IndexOfKey(syncPoint.SubtitleNumber); }
public int CompareCurrentTo(SyncPoint otherSyncPoint) { return(current.CompareTo(otherSyncPoint.Current)); }
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(); }