private void Videos_SelectedIndexChanged(object sender, EventArgs e) { if (videos.SelectedItem == null) { return; } currentVideotape = (Videos)videos.SelectedItem; axWindowsMediaPlayer.Ctlcontrols.stop(); timeLine.CurrentPosition = 0; #region Show tape data foreach (Control c in splitContainer6.Panel1.Controls) { if (c is TextBox) { c.Text = ""; } } Cursor = Cursors.WaitCursor; bdComment.Text = currentVideotape.Commentaire; bdPeriode.Text = currentVideotape.Periode; bdTitreFichier.Text = currentVideotape.Directory; bdTitreBande.Text = currentVideotape.Titre; if ((currentVideotape.NombreFrames == null) | (currentVideotape.NombreFrames == 0)) { //Cursor = Cursors.Default; //return; currentVideotape.NombreFrames = currentVideotape.Frames; md.SaveChanges(); if (currentVideotape.NombreShots == null) { currentVideotape.NombreShots = currentVideotape.Shots.Count; if (currentVideotape.NombreScènes == null) { currentVideotape.NombreScènes = currentVideotape.Scenes.Count; } md.SaveChanges(); } } bdNumberOfShots.Text = currentVideotape.NombreShots?.ToString(); bdNumberOfScenes.Text = currentVideotape.NombreScènes.ToString(); bdDuration.Text = currentVideotape.Durée; bdFrames.Text = currentVideotape.NombreFrames?.ToString(); local.Text = currentVideotape.Shots.Count + " clips, " + currentVideotape.Durée; #endregion #region Paramètres if (currentVideotape.Mode == "dvsd") { BasePath = Disque + @"\Vidéos\DVRender SD\"; } else { BasePath = Disque + @"\Vidéos\HDWRITER\"; } #endregion Cursor = Cursors.WaitCursor; displayScenesPanel.Init(currentVideotape); timeLine.Init(currentVideotape); currentScene = currentVideotape.Scenes.First(); sceneIndexControl.SetScene(currentScene); timeLine.SetStart(currentScene); Cursor = Cursors.Default; return; }
private void DisplayPanel_Paint(object sender, PaintEventArgs e) { if ((scenes == null) || (scenes.Count == 0)) { return; } int x = 0; int y = 0; int largeur = (int)(scenes[0].Videos.Largeur * ImageZoomFactor) / Facteur; int hauteur = (int)(scenes[0].Videos.Hauteur * ImageZoomFactor) / Facteur; size = 6; int fontSize = (int)(size * ImageZoomFactor); int interval = (int)(2 * size * ImageZoomFactor); Font f = new Font("Times New Roman", fontSize); imagesPerRow = Math.Max(1, Width / largeur); scrollPictures.Maximum = scenes.Count; scrollPictures.Value = startImage / imagesPerRow; x = 0; y = 0; //Scenes s = scenes.FirstOrDefault(m => m.Selected); //if (s != null) // startImage = scenes.IndexOf(s); for (int i = startImage; i < scenes.Count; i++) { try { #region Show image Data scrollPictures.Value = startImage; Scenes scene = scenes[i]; if (scene.Selected) { Pen p = new Pen(new SolidBrush(Color.Red), 3); e.Graphics.DrawRectangle(p, new Rectangle(x, y, largeur, hauteur)); } if (scene.Image != null) { MemoryStream mi = new MemoryStream(scene.Image); Image imi = Image.FromStream(mi); e.Graphics.DrawImage(imi, new Rectangle(x, y, largeur, hauteur)); imi.Dispose(); GC.Collect(); } else { if (scene.SequenceScene.Count > 0) { MemoryStream mi = new MemoryStream(scene.SequenceScene.First().Shots.Image); Image imi = Image.FromStream(mi); e.Graphics.DrawImage(imi, new Rectangle(x, y, largeur, hauteur)); imi.Dispose(); GC.Collect(); } } Détails = true; List <string> textes = new List <string> { scene.FrameCount.ToString() + " Frames soit " + Videos.DuréeShot((int)scene.FrameCount), scene.Titre + " ", scene.Lieux?.Villes.Nom + " " + scene.Lieux?.Lieu }; string deb = scene.SequenceScene.FirstOrDefault().Shots.DateShot.Value.ToShortDateString(); if (scene.SequenceScene.First().Shots.Fichier.Contains("Clip")) { string s = Path.GetFileNameWithoutExtension(scene.SequenceScene.First().Shots.Fichier); int ind = s.IndexOf("Clip ") + 4; s = s.Substring(ind, s.Length - ind); string ll = Path.GetFileNameWithoutExtension(scene.SequenceScene.Last().Shots.Fichier); ind = ll.IndexOf("Clip ") + 4; ll = ll.Substring(ind, ll.Length - ind); textes.Add(deb + " " + scene.SequenceScene.Count.ToString() + " clips " + s + "-" + ll); } else { string s = Path.GetFileNameWithoutExtension(scene.SequenceScene.First().Shots.Fichier); string ll = Path.GetFileNameWithoutExtension(scene.SequenceScene.Last().Shots.Fichier); textes.Add(deb + " " + scene.SequenceScene.Count.ToString() + " clips " + s + "-" + ll); } nombreLignes = 0;; if (Détails) { foreach (string s in textes) { e.Graphics.DrawString(s, f, Brushes.Black, new Point(x, y + hauteur + nombreLignes * interval)); nombreLignes++; } } x += largeur; if (x > Width - largeur) { x = 0; y += hauteur; if (Détails) { y += nombreLignes * interval; } } #endregion if (y > Height) { return; } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } }
private void TimeLine_Paint(object sender, PaintEventArgs e) { if (shots == null) { return; } PointF débutVignette = new PointF(débutDessin, topTrack); #region Encadrement e.Graphics.DrawRectangle(Pens.Black, new Rectangle(0, topTrack, Width, trackHeight)); #endregion int totalFrame = 0; #region Affichage shots foreach (Shots s in shots) { float largeurClipCourant = (int)s.FrameCount / pixelsParSecondes; RectangleF rect = new RectangleF(débutVignette, new System.Drawing.SizeF(largeurClipCourant, trackHeight)); if (rect.Contains(new PointF(débutVignette.X + 1, topTrack + 5))) { s.Dessine(e.Graphics, rect); if (s.Current) { toolStripStatusLabel1.Text = s.Fichier + " " + s.DateShot.ToString() + " " + Videos.DuréeClip((int)s.FrameCount) + " " + s.FrameCount.ToString(); } débutVignette.X += largeurClipCourant; if (débutVignette.X > Width /*LongueurTimeline / pixelsParSecondes*/) { break; } } totalFrame += (int)s.FrameCount; } #endregion e.Graphics.DrawLine(Pens.Black, new PointF(CurrentPosition * pixelsParSecondes, topTrack), new PointF(CurrentPosition * pixelsParSecondes, topTrack + trackHeight + 35)); string temps = (CurrentTime / 60).ToString("d2") + ":" + (CurrentTime % 60).ToString("d2"); e.Graphics.DrawString(temps, new Font("Arial", 8), Brushes.Black, new PointF(CurrentPosition * pixelsParSecondes, topTrack + trackHeight + 35)); #region Graduation ligneGraduation = topTrack + trackHeight + 35; e.Graphics.DrawLine(Pens.Black, 0, ligneGraduation, Width, ligneGraduation); int x = 0; int heures = 0; int minutes = 0; int dizaines = 0; TimeSpan ts = Videos.DuréeClip(LongueurTimeline); //while (x < LongueurTimeline) //{ // int j = (x + (int)débutDessin); // if (x % (int)(60 * pixelsParSecondes) == 0) //minutes // { // e.Graphics.DrawLine(Pens.Black, j, ligneGraduation, j, ligneGraduation - mn); // e.Graphics.DrawString(minutes.ToString() + " '", new Font("Arial", 8), Brushes.Blue, new Point(j - 4, ligneGraduation - 20 - 10)); // minutes++; // dizaines = 0; // } // else if (x % (int)(10 * pixelsParSecondes) == 0) // dizaines de secondes // { // dizaines += 10; // e.Graphics.DrawLine(Pens.Black, j, ligneGraduation, j, ligneGraduation - sec); // e.Graphics.DrawString(dizaines.ToString() + " \"", new Font("Arial", 6), Brushes.Red, new Point(j - 4, ligneGraduation - sec - 10)); // } // else // e.Graphics.DrawLine(Pens.Black, j, ligneGraduation, j, ligneGraduation - sec); // x += (int)(10 * pixelsParSecondes); // if ((x + (int)débutDessin) > Width) // break; // if (heures > ts.Hours) // return; // if ((minutes - 1) * 60 + dizaines > ts.TotalSeconds) // return; //} while (x < LongueurTimeline) { int j = (int)((x * 25) / pixelsParSecondes) + (int)débutDessin; if (x % 60 == 0) //minutes { e.Graphics.DrawLine(Pens.Black, j, ligneGraduation, j, ligneGraduation - mn); e.Graphics.DrawString(minutes.ToString() + " '", new Font("Arial", 8), Brushes.Blue, new Point(j - 4, ligneGraduation - 20 - 10)); minutes++; dizaines = 0; } else if (x % 10 == 0) // dizaines de secondes { dizaines += 10; e.Graphics.DrawLine(Pens.Black, j, ligneGraduation, j, ligneGraduation - sec); e.Graphics.DrawString(dizaines.ToString() + " \"", new Font("Arial", 6), Brushes.Red, new Point(j - 4, ligneGraduation - sec - 10)); } else { e.Graphics.DrawLine(Pens.Black, j, ligneGraduation, j, ligneGraduation - sec); } x += 10; if ((x + (int)débutDessin) > Width) { break; } if (heures > ts.Hours) { return; } if ((minutes - 1) * 60 + dizaines > ts.TotalSeconds) { return; } } #endregion }
private void DisplayPanel_Paint(object sender, PaintEventArgs e) { if (media == null) { return; } int x = 0; int y = 0; int w = (int)(media[0].Largeur * ImageZoomFactor) / Facteur; int h = (int)(media[0].Hauteur * ImageZoomFactor) / Facteur; int fontSize = (int)(size * ImageZoomFactor); int interval = (int)(2 * size * ImageZoomFactor); Font f = new Font("Times New Roman", fontSize); imagesPerRow = Math.Max(1, Width / w); scrollPictures.Maximum = 10; scrollPictures.Maximum = media.Count; scrollPictures.Value = startImage / imagesPerRow; x = 0; y = 0; Shots s = media.FirstOrDefault(m => m.Selected); if (s != null) { startImage = media.IndexOf(s); } for (int i = startImage; i < media.Count; i++) { try { #region Show image Data scrollPictures.Value = startImage; Shots clip = media[i]; if (clip.Selected) { Pen p = new Pen(new SolidBrush(Color.Red), 3); e.Graphics.DrawRectangle(p, new Rectangle(x, y, w, h)); } if (clip.Image != null) { MemoryStream mi = new MemoryStream(clip.Image); Image imi = Image.FromStream(mi); e.Graphics.DrawImage(imi, new Rectangle(x, y, w, h)); imi.Dispose(); } //else //{ // string d = Path.GetDirectoryName(clip.FichierImage); // int ix = d.LastIndexOf(@"\"); // string c = d.Substring(ix); // string fi = Path.GetFileNameWithoutExtension(clip.FichierImage); // Image im = Image.FromFile(@"E:\VideoThumbs\" + c + "\\" + fi + ".jpg"); // e.Graphics.DrawImage(im, x, y, w, h); // e.Graphics.DrawRectangle(Pens.Red, x, y, w, h); //} if (Détails) { List <String> textes = new List <string>(); string longueur = Videos.DuréeShot((int)clip.FrameCount); textes.Add(clip.DateShot?.ToLongDateString() + " " + clip.DateShot?.ToLongTimeString()); textes.Add(clip.FrameCount.ToString() + " Frames soit " + longueur); textes.Add("Tape " + clip.Code_Bande.ToString() + " Shot : " + Path.GetFileNameWithoutExtension(clip.Fichier)); textes.Add(clip.Commentaire + " " + clip.Lieux?.Lieu); if (clip.Largeur == 1980) { size = 14; } e.Graphics.DrawString(clip.DateShot?.ToLongDateString() + " " + clip.DateShot?.ToLongTimeString(), f, Brushes.Black, new Point(x, y + h)); e.Graphics.DrawString(clip.FrameCount.ToString() + " Frames soit " + longueur, f, Brushes.Black, new Point(x, y + h + interval)); e.Graphics.DrawString("Tape " + clip.Code_Bande.ToString() + " Shot : " + Path.GetFileNameWithoutExtension(clip.Fichier), f, Brushes.Black, new Point(x, y + h + 2 * interval)); e.Graphics.DrawString(clip.Commentaire + " " + clip.Lieux?.Lieu, f, Brushes.Black, new Point(x, y + h + 3 * interval)); } x += w + 10; if (x > Width - w) { x = 0; y += h; if (Détails) { y += 4 * interval; } } #endregion if (y > Height) { return; } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } }