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

            to = nodes.FirstOrDefault (n => n.TimeNode == node);
            if (to != null) {
                RemoveObject (to, true);
            }
        }
Beispiel #3
0
 public void Cancel()
 {
     if (currentNode == null)
         return;
     if (Timer != null) {
         Timer.CancelCurrent ();
         currentNode = null;
     }
 }
Beispiel #4
0
 public TimerTimeNodeObject(Timer t, TimeNode tn)
     : base(tn)
 {
     Timer = t;
 }
Beispiel #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);
 }
Beispiel #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;
 }
Beispiel #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))
         };
 }
 public TimeNodeObject(TimeNode node)
     : base(node)
 {
 }
Beispiel #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));
        }
Beispiel #11
0
        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;
        }
Beispiel #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;
            }
        }
Beispiel #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);
            }
        }
Beispiel #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);
 }
Beispiel #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 ());
        }
Beispiel #16
0
 public bool HasNode(TimeNode tn)
 {
     return nodes.FirstOrDefault (n => n.TimeNode == tn) != null;
 }
Beispiel #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;
        }
Beispiel #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))
         };
 }
Beispiel #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;
 }
Beispiel #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);
     }
 }
Beispiel #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 ();
     }
 }
        /// <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
            });
        }
Beispiel #23
0
 public TimerButton()
 {
     BackgroundColor = StyleConf.ButtonTimerColor;
     currentNode = null;
 }