public void Start(Time start, string name = null) { if (name == null) name = Name; Stop (start); TimeNode tn = new TimeNode {Name = name, Start = start}; Nodes.Add (tn); }
public void Stop(Time stop) { if (Nodes.Count > 0) { TimeNode last = Nodes.Last (); if (last.Stop == null) { last.Stop = stop; } } }
private void ProcessNewTag(Category category,Time pos) { Time length, startTime, stopTime, start, stop, fStart, fStop; if(player == null || openedProject == null) return; /* Get the default lead and lag time for the category */ startTime = category.Start; stopTime = category.Stop; /* Calculate boundaries of the segment */ start = pos - startTime; stop = pos + stopTime; fStart = (start < new Time {MSeconds =0}) ? new Time {MSeconds = 0} : start; if(projectType == ProjectType.FakeCaptureProject || projectType == ProjectType.CaptureProject) { fStop = stop; } else { length = new Time {MSeconds = (int)player.StreamLength}; fStop = (stop > length) ? length: stop; } AddNewPlay(fStart, fStop, category); }
private void AddNewPlay(Time start, Time stop, Category category) { Image miniature; Log.Debug(String.Format("New play created start:{0} stop:{1} category:{2}", start, stop, category)); /* Get the current frame and get a thumbnail from it */ if(projectType == ProjectType.CaptureProject) { if(!capturer.Capturing) { guiToolkit.InfoMessage(Catalog.GetString("You can't create a new play if the capturer "+ "is not recording.")); return; } miniature = capturer.CurrentMiniatureFrame; } else if(projectType == ProjectType.FileProject) { miniature = player.CurrentMiniatureFrame; player.Pause(); } else miniature = null; /* Add the new created play to the project and update the GUI*/ var play = openedProject.AddPlay(category, start, stop,miniature); mainWindow.AddPlay(play); /* Tag subcategories of the new play */ LaunchPlayTagger(play); if (projectType == ProjectType.FileProject) { player.Play(); } }
protected virtual void OnTimeline2PositionChanged(Time pos) { player.SeekInSegment(pos.MSeconds); }
protected virtual void OnNewTagAtFrame(Category category, int frame) { Time pos = new Time { MSeconds = frame*1000/openedProject.Description.File.Fps}; player.CloseActualSegment(); player.SeekTo((long)pos.MSeconds, true); ProcessNewTag(category,pos); }
public virtual void OnNewTag(Category category) { Time pos; if(projectType == ProjectType.FakeCaptureProject || projectType == ProjectType.CaptureProject) { pos = new Time { MSeconds = (int)capturer.CurrentTime}; } else { pos = new Time {MSeconds = (int)player.CurrentTime}; } ProcessNewTag(category,pos); }
private void GdkDraw(EventExpose evnt,int height,int width) { Time time = new Time(); layout.SetMarkup("0"); this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal),0,height-23,layout); Gdk.Point topL= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll-5),height-15); Gdk.Point topR= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll+5),height-15); Gdk.Point bottom= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll),height); this.GdkWindow.DrawPolygon(this.Style.TextGC(StateType.Normal),true,new Gdk.Point[] {topL,topR,bottom}); for(int i=10*FrameRate; i<=frames/pixelRatio;) { // Drawing separator line evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-10); time.Seconds = (int)(i/FrameRate*pixelRatio); layout.SetMarkup(time.ToSecondsString()); this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal),i-(int)Scroll-13,height-23,layout); //g.ShowText(time.ToSecondsString()); i=i+10*FrameRate; } for(int i=0; i<=frames/pixelRatio;) { evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-5); i=i+FrameRate; } // Drawing main line evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),0,height,width,height); }
private void StopGameUnit(GameUnit gameUnit) { TimelineNode timeInfo; Time start, stop; if (!gameUnitsStarted.ContainsKey(gameUnit)) { Log.Warning("Tryed to stop a game unit that was not started: " + gameUnit); return; } start = gameUnitsStarted[gameUnit]; stop = new Time{MSeconds=(int)player.CurrentTime}; timeInfo = new TimelineNode {Name=gameUnit.Name, Fps=fps, Start=start, Stop=stop}; gameUnit.Add(timeInfo); gameUnitsStarted.Remove(gameUnit); Log.Debug(String.Format("Added new unit:{0} to {1} ", timeInfo, gameUnit)); }
private void EmitUnitChanged(GameUnit gameUnit, TimelineNode unit, Time time) { if (UnitChanged != null) UnitChanged(gameUnit, unit, time); }
public GameUnitWidget(GameUnit gameUnit) { AddGameUnitButton(); GameUnit = gameUnit; CurrentTime = new Time {MSeconds = 0}; }
void OnButtonClicked(object sender, EventArgs args) { GameUnitEventType eType; SetMode(sender != startButton); if (sender == startButton) { start = current; eType = GameUnitEventType.Start; } else if (sender == stopButton) { eType = GameUnitEventType.Stop; start = null; } else eType = GameUnitEventType.Cancel; EmitGameUnitEvent(eType); }
/// <summary> /// Adds a new play to a given category /// </summary> /// <param name="dataSection"> /// A <see cref="System.Int32"/>: category index /// </param> /// <param name="start"> /// A <see cref="Time"/>: start time of the play /// </param> /// <param name="stop"> /// A <see cref="Time"/>: stop time of the play /// </param> /// <param name="thumbnail"> /// A <see cref="Pixbuf"/>: snapshot of the play /// </param> /// <returns> /// A <see cref="MediaTimeNode"/>: created play /// </returns> public Play AddPlay(Category category, Time start, Time stop, Image miniature) { string count= String.Format("{0:000}", PlaysInCategory (category).Count + 1); string name = String.Format("{0} {1}",category.Name, count); var play = new Play { Name = name, Start = start, Stop = stop, Category = category, Notes = "", Miniature = miniature, Fps = Description.File.Fps, }; timeline.Add(play); return play; }
public virtual void OnNewPlayStart() { startTime = new Time {MSeconds = (int)player.CurrentTime}; Log.Debug("New play start time: " + startTime); }
private void CairoDraw(EventExpose evnt,int height,int width) { Time time = new Time(); using(Cairo.Context g = Gdk.CairoHelper.Create(evnt.Window)) { Cairo.Color color = new Cairo.Color(0, 0, 0); /* Drawing position triangle */ CairoUtils.DrawTriangle(g,CurrentFrame/pixelRatio-Scroll, height, 10, 15, color); /* Draw '0' */ CairoUtils.DrawLine(g, 0-Scroll, height, width, height, 2, color); g.MoveTo(new PointD(0-Scroll,height-20)); g.ShowText("0"); for(int i=10*FrameRate; i<=frames/pixelRatio;) { CairoUtils.DrawLine(g, i-Scroll, height,i-Scroll, height-10, 2, color); g.MoveTo(new PointD(i-Scroll-13,height-20)); time.Seconds = (int)(i/FrameRate*pixelRatio); g.ShowText(time.ToSecondsString()); i=i+10*FrameRate; } for(int i=0; i<=frames/pixelRatio;) { CairoUtils.DrawLine(g, i-Scroll, height,i-Scroll, height-5, 1, color); i=i+FrameRate; } } }
public virtual void OnNewPlayStop(Category category) { int diff; Time stopTime = new Time {MSeconds = (int)player.CurrentTime}; Log.Debug("New play stop time: " + stopTime); diff = stopTime.MSeconds - startTime.MSeconds; if(diff < 0) { guiToolkit.WarningMessage(Catalog.GetString("The stop time is smaller than the start time. "+ "The play will not be added.")); return; } if(diff < 500) { int correction = 500 - diff; if(startTime.MSeconds - correction > 0) startTime = startTime - correction; else stopTime = stopTime + correction; } AddNewPlay(startTime, stopTime, category); }
void HandleUnitChanged(GameUnit gameUnit, TimelineNode unit, Time time) { player.CloseActualSegment(); player.Pause(); player.SeekTo(time.MSeconds, true); }