Inheritance: TimeNode, ISerializable
Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 private void EmitNewTagAtFrame(Category category, int frame)
 {
     if (NewTagAtFrameEvent != null)
         NewTagAtFrameEvent(category, frame);
 }
Ejemplo n.º 7
0
 private void EmitNewTagStop(Category category)
 {
     if (NewTagStopEvent != null)
         NewTagStopEvent (category);
 }
Ejemplo n.º 8
0
 public List<Play> PlaysInCategory(Category category)
 {
     return timeline.Where(p => p.Category.UUID == category.UUID).ToList();
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Delete a category
        /// </summary>
        /// <param name="sectionIndex">
        /// A <see cref="System.Int32"/>: category index
        /// </param>
        public void RemoveCategory(Category category)
        {
            if(Categories.Count == 1)
                throw new Exception("You can't remove the last Category");
            Categories.Remove(category);

            timeline.RemoveAll(p => p.Category.UUID == category.UUID);
        }
Ejemplo n.º 10
0
 public void DeleteSubcategoryTags(Category cat, List<ISubCategory> subcategories)
 {
     foreach (var play in timeline.Where(p => p.Category == cat)) {
         foreach (var subcat in subcategories) {
             Log.Error(play.Name);
             if (subcat is TagSubCategory)
                 play.Tags.RemoveBySubcategory(subcat);
             else if (subcat is TeamSubCategory)
                 play.Teams.RemoveBySubcategory(subcat);
             else if (subcat is PlayerSubCategory)
                 play.Players.RemoveBySubcategory(subcat);
         }
     }
 }
Ejemplo n.º 11
0
        /// <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;
        }
Ejemplo n.º 12
0
 protected virtual void OnHotKeyChanged(HotKey prevHotKey, Category category)
 {
     if(hkList.Contains(category.HotKey)) {
         MessagePopup.PopupMessage(this,MessageType.Warning,
                                   Catalog.GetString("This hotkey is already in use."));
         category.HotKey=prevHotKey;
         timenodeproperties2.Category = category; //Update Gui
     }
     else if(category.HotKey.Defined) {
         hkList.Remove(prevHotKey);
         hkList.Add(category.HotKey);
     }
 }
Ejemplo n.º 13
0
 private string CategoryPath(Category cat)
 {
     return project.Categories.IndexOf(cat).ToString();
 }
Ejemplo n.º 14
0
        void GetPlayersStats(Project project, List<Play> subcatPlays, string optionName,
			SubCategoryStat subcatStat, Category cat)
        {
            foreach (ISubCategory subcat in cat.SubCategories) {
                PlayerSubCategory playerSubcat;
                Dictionary<Player, int> localPlayerCount = new Dictionary<Player, int>();
                Dictionary<Player, int> visitorPlayerCount = new Dictionary<Player, int>();

                if (!(subcat is PlayerSubCategory))
                    continue;

                playerSubcat = subcat as PlayerSubCategory;

                if (playerSubcat.Contains(Team.LOCAL) || playerSubcat.Contains(Team.BOTH)){
                    foreach (Player player in project.LocalTeamTemplate) {
                        localPlayerCount.Add(player, GetPlayerCount(subcatPlays, player, subcat as PlayerSubCategory));
                    }
                    subcatStat.AddPlayersStats(optionName, subcat.Name, Team.LOCAL, localPlayerCount);
                }

                if (playerSubcat.Contains(Team.VISITOR) || playerSubcat.Contains(Team.BOTH)){
                    foreach (Player player in project.VisitorTeamTemplate) {
                        visitorPlayerCount.Add(player, GetPlayerCount(subcatPlays, player, subcat as PlayerSubCategory));
                    }
                    subcatStat.AddPlayersStats(optionName, subcat.Name, Team.VISITOR, visitorPlayerCount);
                }
            }
        }