예제 #1
0
 public TimeNodeObject(TimeNode node)
 {
     TimeNode = node;
     SelectionMode = NodeSelectionMode.All;
     DraggingMode = NodeDraggingMode.All;
     LineColor = Config.Style.PaletteBackgroundLight;
     Height = StyleConf.TimelineCategoryHeight;
     StrictClipping = true;
 }
예제 #2
0
        public void RemoveNode(TimeNode node)
        {
            TimeNodeObject to;

            to = nodes.FirstOrDefault (n => n.TimeNode == node);
            if (to != null) {
                RemoveObject (to, true);
            }
        }
예제 #3
0
 public void Cancel()
 {
     if (currentNode == null)
         return;
     if (Timer != null) {
         Timer.CancelCurrent ();
         currentNode = null;
     }
 }
예제 #4
0
 public TimerTimeNodeObject(Timer t, TimeNode tn)
     : base(tn)
 {
     Timer = t;
 }
예제 #5
0
 public void EmitTimeNodeChanged(TimeNode tn, Time time)
 {
     if (TimeNodeChanged != null)
         TimeNodeChanged (tn, time);
 }
 void HandleCameraDragged(MediaFile mediafile, TimeNode timenode)
 {
     // Start by pausing players
     Pause ();
     // And update
     HandleCameraUpdate (camerasTimeline.SelectedCamera);
 }
예제 #7
0
 public void ResumePeriod()
 {
     if (currentPeriod == null) {
         string msg = Catalog.GetString ("Period recording not started");
         Config.GUIToolkit.WarningMessage (msg, this);
         return;
     }
     Log.Debug ("Resume period at currentTime=", CurrentCaptureTime.ToMSecondsString ());
     currentTimeNode = currentPeriod.Start (CurrentCaptureTime);
     pausebutton.Visible = true;
     resumebutton.Visible = false;
     Capturing = true;
 }
예제 #8
0
 public TimeNode Intersect(TimeNode tn)
 {
     if (tn.Stop == null || tn.Start == null || Start == null || Stop == null)
         return null;
     if (tn.Stop <= Start || tn.Start >= Stop)
         return null;
     else
         return new TimeNode {
             Start = new Time (Math.Max (Start.MSeconds, tn.Start.MSeconds)),
             Stop = new Time (Math.Min (Stop.MSeconds, tn.Stop.MSeconds))
         };
 }
예제 #9
0
 public TimeNodeObject(TimeNode node)
     : base(node)
 {
 }
예제 #10
0
        void UpdateTimePlayed()
        {
            LineupEvent lineup = project.Lineup;
            List<SubstitutionEvent> subs;
            Time start;
            List<TimeNode> timenodes, playingTimeNodes;
            TimeNode last;

            subs = project.EventsByType (project.SubstitutionsEventType).
                Where (s => !(s is LineupEvent) && ((s as SubstitutionEvent).In == Player ||
            (s as SubstitutionEvent).Out == Player))
                .OrderBy (e => e.EventTime).Select (e => e as SubstitutionEvent).ToList ();

            if (lineup.AwayStartingPlayers.Contains (Player) ||
                lineup.HomeStartingPlayers.Contains (Player)) {
                start = lineup.EventTime;
            } else {
                SubstitutionEvent sub = subs.Where (s => s.In == Player).FirstOrDefault ();
                if (sub == null) {
                    TimePlayed = new Time (0);
                    return;
                } else {
                    start = sub.EventTime;
                }
            }

            timenodes = new List<TimeNode> ();
            /* Find the sequences of playing time */
            last = new TimeNode { Start = start };
            timenodes.Add (last);
            if (subs.Count == 0) {
                last.Stop = project.Description.FileSet.Duration;
            } else {
                foreach (SubstitutionEvent sub in subs) {
                    if (last.Stop == null) {
                        if (sub.Out == Player) {
                            last.Stop = sub.EventTime;
                        }
                    } else {
                        if (sub.In == Player) {
                            last = new TimeNode { Start = sub.EventTime };
                            timenodes.Add (last);
                        }
                    }
                }
            }

            /* If the last substitution was Player IN */
            if (last.Stop == null) {
                last.Stop = project.Description.FileSet.Duration;
            }

            playingTimeNodes = new List<TimeNode> ();
            /* Get the real playing time intersecting with the periods */
            foreach (TimeNode timenode in timenodes) {
                foreach (Period p in project.Periods) {
                    if (p.PeriodNode.Intersect (timenode) != null) {
                        foreach (TimeNode ptn in p.Nodes) {
                            TimeNode res = ptn.Intersect (timenode);
                            if (res != null) {
                                playingTimeNodes.Add (res);
                            }
                        }
                    }
                }
            }

            TimePlayed = new Time (playingTimeNodes.Sum (t => t.Duration.MSeconds));
        }
예제 #11
0
파일: Timer.cs 프로젝트: GNOME/longomatch
        public TimeNode Start(Time start, string name = null)
        {
            TimeNode tn;

            if (name == null)
                name = Name;
            Stop (start);
            tn = new TimeNode { Name = name, Start = start };
            Nodes.Add (tn);
            return tn;
        }
예제 #12
0
        public void Stop(Time stop, List<DashboardButton> from)
        {
            if (currentNode == null)
                return;

            if (Timer != null) {
                Timer.Stop (stop);
                Config.EventsBroker.EmitTimeNodeStoppedEvent (currentNode, this, from);
                currentNode = null;
            }
        }
예제 #13
0
        public void Start(Time start, List<DashboardButton> from)
        {
            if (currentNode != null)
                return;

            if (Timer != null) {
                currentNode = Timer.Start (start);
                Config.EventsBroker.EmitTimeNodeStartedEvent (currentNode, this, from);
            }
        }
예제 #14
0
 public void AddTimeNode(Timer t, TimeNode tn)
 {
     TimerTimeNodeObject to = new TimerTimeNodeObject (t, tn);
     to.OffsetY = OffsetY;
     to.Height = Height;
     to.SecondsPerPixel = SecondsPerPixel;
     to.MaxTime = maxTime;
     to.DraggingMode = DraggingMode;
     to.ShowName = ShowName;
     to.LineColor = LineColor;
     AddNode (to);
 }
예제 #15
0
        public void StartPeriod()
        {
            string periodName;

            if (currentPeriod != null) {
                string msg = Catalog.GetString ("Period recording already started");
                Config.GUIToolkit.WarningMessage (msg, this);
                return;
            }
            recbutton.Visible = false;
            pausebutton.Visible = savebutton.Visible = stopbutton.Visible = true;

            if (PeriodsNames != null && PeriodsNames.Count > Periods.Count) {
                periodName = PeriodsNames [Periods.Count];
            } else {
                periodName = (Periods.Count + 1).ToString ();
            }
            currentPeriod = new Period { Name = periodName };

            currentTimeNode = currentPeriod.Start (accumTime, periodName);
            currentTimeNode.Stop = currentTimeNode.Start;
            currentPeriodStart = DateTime.UtcNow;
            timeoutID = GLib.Timeout.Add (20, UpdateTime);
            if (Capturer != null) {
                if (Periods.Count == 0) {
                    Capturer.Start ();
                } else {
                    Capturer.TogglePause ();
                }
            }
            periodlabel.Markup = currentPeriod.Name;
            Capturing = true;
            Periods.Add (currentPeriod);
            Log.Debug ("Start new period start=", currentTimeNode.Start.ToMSecondsString ());
        }
예제 #16
0
 public bool HasNode(TimeNode tn)
 {
     return nodes.FirstOrDefault (n => n.TimeNode == tn) != null;
 }
예제 #17
0
        public void StopPeriod()
        {
            if (currentPeriod == null) {
                string msg = Catalog.GetString ("Period recording not started");
                Config.GUIToolkit.WarningMessage (msg, this);
                return;
            }

            GLib.Source.Remove (timeoutID);
            currentPeriod.Stop (CurrentCaptureTime);
            accumTime = CurrentCaptureTime;
            Log.Debug ("Stop period stop=", accumTime.ToMSecondsString ());
            currentTimeNode = null;
            currentPeriod = null;
            recbutton.Visible = true;
            pausebutton.Visible = resumebutton.Visible = stopbutton.Visible = false;
            if (Capturer != null && Capturing) {
                Capturer.TogglePause ();
            }
            Capturing = false;
        }
예제 #18
0
 public TimeNode Join(TimeNode tn)
 {
     if (tn.Stop < Start || tn.Start > Stop)
         return null;
     else
         return new TimeNode {
             Start = new Time (Math.Min (Start.MSeconds, tn.Start.MSeconds)),
             Stop = new Time (Math.Max (Stop.MSeconds, tn.Stop.MSeconds))
         };
 }
예제 #19
0
 void Reset()
 {
     currentPeriod = null;
     currentTimeNode = null;
     currentPeriodStart = DateTime.UtcNow;
     accumTime = new Time (0);
     Capturing = false;
     Capturer = null;
     recbutton.Visible = true;
     stopbutton.Visible = false;
     pausebutton.Visible = false;
     savebutton.Visible = false;
     cancelbutton.Visible = true;
     resumebutton.Visible = false;
     lasteventbox.Visible = false;
 }
예제 #20
0
 public void EmitTimeNodeStoppedEvent(TimeNode node, TimerButton btn, List<DashboardButton> from)
 {
     if (TimeNodeStoppedEvent != null) {
         if (from == null)
             from = new List<DashboardButton> ();
         TimeNodeStoppedEvent (node, btn, from);
     }
 }
예제 #21
0
 public void AddTimerNode(Timer timer, TimeNode tn)
 {
     TimerTimeline tl = Objects.OfType<TimerTimeline> ().FirstOrDefault (t => t.HasTimer (timer));
     if (tl != null) {
         tl.AddTimeNode (timer, tn);
         widget.ReDraw ();
     }
 }
예제 #22
0
        /// <summary>
        /// Periods segments have moved, adjust main camera position to segment boundaries
        /// </summary>
        void HandleTimeNodeChanged(TimeNode tNode, object val)
        {
            Time time = val as Time;

            Pause ();
            // Don't try to be accurate here. We are looking for period starts
            Seek (new SeekEvent {
                Time = time,
                Accurate = false
            });
        }
예제 #23
0
 public TimerButton()
 {
     BackgroundColor = StyleConf.ButtonTimerColor;
     currentNode = null;
 }