示例#1
0
 public FormPlayer(ScenePart first)
 {
     InitializeComponent();
     currentScene   = firstScene = first;
     listeningInput = false;
     waitingForEnd  = false;
 }
示例#2
0
        public ScenePart CreateScene(string videoFile = "", string title = "", int id = -1)
        {
            ScenePart n = new ScenePart(id);

            scenes[n.id] = n;
            n.videoFile  = videoFile;

            PictureBox p = new PictureBox();

            p.Visible           = true;
            p.Size              = new Size(150, 96);
            p.BorderStyle       = BorderStyle.FixedSingle;
            p.SizeMode          = PictureBoxSizeMode.StretchImage;
            p.MouseDown        += thumbnail_MouseDown;
            p.MouseMove        += thumbnail_MouseMove;
            p.MouseClick       += thumbnail_MouseClick;
            p.MouseDoubleClick += thumbnail_DoubleClick;
            p.ContextMenuStrip  = cms;

            Label l = new Label();

            n.title = l.Text = (title.Equals(string.Empty)) ? ("Cena " + n.id) : title;
            p.Controls.Add(l);

            p.Tag = n.id; // for convenience
            group.Controls.Add(p);
            n.thumbnail = p;

            if (firstScene == null)
            {
                SetAsFirstScene(n.id);
            }

            return(n);
        }
示例#3
0
 public void DecRef(ScenePart to)
 {
     if (refcount.ContainsKey(to) && --refcount[to] <= 0)
     {
         refcount.Remove(to);
     }
 }
示例#4
0
        private void StartVideoFrom(ScenePart scene)
        {
            FormPlayer p = new FormPlayer(scene);

            p.Play();
            p.ShowDialog();
        }
示例#5
0
 private void DrawSceneBorder(Pen p, ScenePart scene, Graphics g)
 {
     if (scene != null)
     {
         g.DrawRectangle(p, new Rectangle(scene.thumbnail.Location, scene.thumbnail.Size));
     }
 }
示例#6
0
 public void Start(ScenePart scene)
 {
     listeningInput = false;
     currentScene   = scene;
     //HideOverlays();
     Stop();
     Play();
 }
示例#7
0
 public void AddRef(ScenePart to)
 {
     if (!refcount.ContainsKey(to))
     {
         refcount[to] = 0;
     }
     ++refcount[to];
 }
示例#8
0
 public void SetAsFirstScene(int id)
 {
     if (id < 0)
     {
         return;
     }
     firstScene = scenes[id];
     group.Invalidate();
 }
示例#9
0
        public SceneTransition CreateTransition(ScenePart src, ScenePart dest, TransitionID type)
        {
            SceneTransition t = SceneTransition.Create(type);

            t.nextScene = dest;
            src.transitions.Add(t);
            dest.AddRef(src);
            group.Invalidate();
            return(t);
        }
 public FormSceneProperties(ScenePart scene)
 {
     InitializeComponent();
     this.scene                 = scene;
     groupBox1.Text             = "Propriedades de " + scene.title;
     textBoxTitle.Text          = scene.title;
     textBoxSource.Text         = scene.videoFile;
     thumbnailBox.ImageLocation = scene.thumbnail.ImageLocation;
     listTransitions.DataSource = scene.transitions;
 }
示例#11
0
        private void thumbnail_MouseClick(object sender, MouseEventArgs e)
        {
            Control thumbnail = (Control)sender;

            if (selectNextScene)
            {
                SceneTransition t = CreateTransition(selected, scenes[(int)thumbnail.Tag], transitionType);
                t.Configure();
                selectNextScene = false;
            }
            else
            {
                /// Sets the starting scene for the "start from the selected scene" option
                selected = scenes[(int)thumbnail.Tag];
                group.Invalidate();
            }
        }
示例#12
0
        public void RemoveScene(int id)
        {
            foreach (ScenePart p in scenes[id].refcount.Keys)
            {
                IReadOnlyList <SceneTransition> tlist = p.transitions.Where(t => t.nextScene.id == id).ToList();
                foreach (SceneTransition t in tlist)
                {
                    p.transitions.Remove(t);
                }
            }

            if (firstScene == scenes[id])
            {
                firstScene = null;
            }
            if (selected == scenes[id])
            {
                selected = null;
            }

            group.Controls.Remove(scenes[id].thumbnail);
            scenes.Remove(id);
            group.Invalidate();
        }
示例#13
0
        public void Load(string filename)
        {
            try
            {
                fname = filename;
                int       firstScene    = -1;
                bool      hasFirstScene = false;
                XmlReader xml           = XmlReader.Create(fname);

                while (xml.Read())
                {
                    if (xml.NodeType == XmlNodeType.Element)
                    {
                        if (xml.Name == "project" && xml.HasAttributes)
                        {
                            title  = xml.GetAttribute("title");
                            author = xml.GetAttribute("author");
                        }
                        else if (xml.Name == "storyboard" && xml.HasAttributes)
                        {
                            ScenePart.id_inc = int.Parse(xml.GetAttribute("lastId"));
                            hasFirstScene    = int.TryParse(xml.GetAttribute("firstScene"), out firstScene);
                        }
                        else if (xml.Name == "scene" && xml.HasAttributes)
                        {
                            ScenePart p = storyboard.CreateScene(
                                xml.GetAttribute("videoSrc"),
                                xml.GetAttribute("title"),
                                int.Parse(xml.GetAttribute("id"))
                                );
                            p.thumbnail.ImageLocation = xml.GetAttribute("thumbSrc");
                            p.timeout = int.Parse(xml.GetAttribute("timeout"));
                            int x = int.Parse(xml.GetAttribute("posX"));
                            int y = int.Parse(xml.GetAttribute("posY"));
                            p.thumbnail.Location = new System.Drawing.Point(x, y);
                        }
                        else if (xml.Name == "transition" && xml.HasAttributes)
                        {
                            ScenePart       src  = storyboard.GetScene(int.Parse(xml.GetAttribute("srcScene")));
                            ScenePart       dest = storyboard.GetScene(int.Parse(xml.GetAttribute("nextScene")));
                            TransitionID    type = (TransitionID)Enum.Parse(typeof(TransitionID), xml.GetAttribute("type"));
                            SceneTransition t    = storyboard.CreateTransition(src, dest, type);
                            if (type == TransitionID.Keyboard)
                            {
                                SceneTransitionKeyboard tk = (SceneTransitionKeyboard)t;
                                tk.keycode = int.Parse(xml.GetAttribute("keycode"));
                                if (!bool.TryParse(xml.GetAttribute("showOverlay"), out tk.showOverlay))
                                {
                                    tk.showOverlay = false;
                                }
                                if (xml.GetAttribute("caption") != null)
                                {
                                    tk.caption = xml.GetAttribute("caption");
                                }
                            }
                        }
                    }
                }
                xml.Close();

                if (hasFirstScene)
                {
                    storyboard.SetAsFirstScene(firstScene);
                }
            }
            catch (Exception e)
            {
#if DEBUG
                MessageBox.Show(e.StackTrace);
#else
                MessageBox.Show("Arquivo de projeto inválido.");
#endif
                if (storyboard != null)
                {
                    storyboard.Clear();
                }
            }
        }
示例#14
0
 public void SetNewTransition(int src, TransitionID type)
 {
     selectNextScene = true;
     selected        = scenes[src];
     transitionType  = type;
 }