Esempio n. 1
0
 public CommandAddChrono(Action _invalidate, Action _undrawn, Metadata _Metadata)
 {
     m_DoInvalidate = _invalidate;
     m_DoUndrawn    = _undrawn;
     m_Metadata     = _Metadata;
     m_Chrono       = m_Metadata.ExtraDrawings[m_Metadata.SelectedExtraDrawing] as DrawingChrono;
 }
        private static string GetChronoStyleVariant(DrawingChrono drawing)
        {
            // Style variants of DrawingChrono: Chrono, Clock.
            if (!drawing.DrawingStyle.Elements.ContainsKey("clock"))
            {
                return("Chrono");
            }

            StyleElementToggle elementToggle = drawing.DrawingStyle.Elements["clock"] as StyleElementToggle;

            if (elementToggle == null)
            {
                return("Chrono");
            }

            bool valueClock = (bool)elementToggle.Value;

            if (valueClock)
            {
                return("Clock");
            }
            else
            {
                return("Chrono");
            }
        }
Esempio n. 3
0
        public formConfigureChrono(DrawingChrono _chrono, PictureBox _SurfaceScreen)
        {
            InitializeComponent();
            m_ResourceManager = new ResourceManager("Kinovea.ScreenManager.Languages.ScreenManagerLang", Assembly.GetExecutingAssembly());

            m_SurfaceScreen = _SurfaceScreen;
            m_Chrono        = _chrono;

            // Save the current state in case we need to recall it later.
            m_Chrono.MemorizeDecoration();

            // Initialize font size combo.
            cmbFontSize.Items.Clear();
            foreach (int size in InfosTextDecoration.AllowedFontSizes)
            {
                cmbFontSize.Items.Add(size.ToString());
            }

            // Show current values:
            cmbFontSize.Text         = m_Chrono.FontSize.ToString();
            btnChronoColor.BackColor = m_Chrono.BackgroundColor;
            FixColors();
            tbLabel.Text         = m_Chrono.Label;
            chkShowLabel.Checked = m_Chrono.ShowLabel;

            // Localize
            this.Text         = "   " + m_ResourceManager.GetString("dlgConfigureChrono_Title", Thread.CurrentThread.CurrentUICulture);
            btnCancel.Text    = m_ResourceManager.GetString("Generic_Cancel", Thread.CurrentThread.CurrentUICulture);
            btnOK.Text        = m_ResourceManager.GetString("Generic_Apply", Thread.CurrentThread.CurrentUICulture);
            grpConfig.Text    = m_ResourceManager.GetString("Generic_Configuration", Thread.CurrentThread.CurrentUICulture);
            lblColor.Text     = m_ResourceManager.GetString("Generic_ColorPicker", Thread.CurrentThread.CurrentUICulture);
            lblFontSize.Text  = m_ResourceManager.GetString("Generic_FontSizePicker", Thread.CurrentThread.CurrentUICulture);
            lblLabel.Text     = m_ResourceManager.GetString("dlgConfigureChrono_Label", Thread.CurrentThread.CurrentUICulture);
            chkShowLabel.Text = m_ResourceManager.GetString("dlgConfigureChrono_chkShowLabel", Thread.CurrentThread.CurrentUICulture);
        }
Esempio n. 4
0
 public CommandDeleteChrono(PlayerScreenUserInterface _psui, Metadata _Metadata)
 {
     m_psui          = _psui;
     m_Metadata      = _Metadata;
     m_iChronoIndex  = m_Metadata.SelectedChrono;
     m_iTotalChronos = m_Metadata.Chronos.Count;
     m_Chrono        = m_Metadata.Chronos[m_iChronoIndex];
 }
Esempio n. 5
0
        public CommandAddChrono(DelegateScreenInvalidate _invalidate, DelegateDrawingUndrawn _undrawn, Metadata _Metadata)
        {
            m_DoInvalidate  = _invalidate;
            m_DoUndrawn     = _undrawn;
            m_Metadata      = _Metadata;
            m_iTotalChronos = m_Metadata.Chronos.Count;

            // Chrono (as all Drawings) are added to the list in reverse order.
            m_Chrono = m_Metadata.Chronos[0];
        }
Esempio n. 6
0
        /// <summary>
        /// Adds a new chronometer drawing.
        /// </summary>
        public void AddChrono(DrawingChrono chrono)
        {
            chronoManager.AddDrawing(chrono);
            chrono.ParentMetadata = this;

            hitDrawing = chrono;

            AfterDrawingCreation(chrono);

            if (DrawingAdded != null)
            {
                DrawingAdded(this, new DrawingEventArgs(chrono, chronoManager.Id));
            }
        }
        public formConfigureChrono(DrawingChrono _chrono, Action _invalidate)
        {
            InitializeComponent();
            m_Invalidate = _invalidate;
            m_Chrono     = _chrono;
            m_Chrono.DrawingStyle.ReadValue();
            m_Chrono.DrawingStyle.Memorize();
            m_MemoLabel      = m_Chrono.Label;
            m_bMemoShowLabel = m_Chrono.ShowLabel;

            SetupForm();
            LocalizeForm();

            tbLabel.Text         = m_Chrono.Label;
            chkShowLabel.Checked = m_Chrono.ShowLabel;
        }
Esempio n. 8
0
        public CommandModifyChrono(PlayerScreenUserInterface _psui, Metadata _Metadata, ChronoModificationType _modifType, long _newValue)
        {
            // In the special case of Countdown toggle, the new value will be 0 -> false, true otherwise .
            m_psui      = _psui;
            m_Metadata  = _Metadata;
            m_Chrono    = m_Metadata.ExtraDrawings[m_Metadata.SelectedExtraDrawing] as DrawingChrono;
            m_iNewValue = _newValue;
            m_ModifType = _modifType;

            // Save old values
            if (m_Chrono != null)
            {
                m_iStartCountingTimestamp = m_Chrono.TimeStart;
                m_iStopCountingTimestamp  = m_Chrono.TimeStop;
                m_iInvisibleTimestamp     = m_Chrono.TimeInvisible;
                m_bCountdown = m_Chrono.CountDown;
            }
        }
Esempio n. 9
0
        private void UpdateMarkersPositions()
        {
            // Translate timestamps into control coordinates and store the coordinates of the
            // markers to draw them later.
            // Should only be called when either the timestamps or the control size changed.
            if (m_Metadata != null)
            {
                // Key frames
                m_KeyframesMarks.Clear();
                foreach (Keyframe kf in m_Metadata.Keyframes)
                {
                    // Only display Key image that are in the selection.
                    if (kf.Position >= m_iMinimum && kf.Position <= m_iMaximum)
                    {
                        m_KeyframesMarks.Add(GetCoordFromTimestamp(kf.Position));
                    }
                }

                // ExtraDrawings
                // We will store the range coords in a Point object, to get a couple of ints structure.
                // X will be the left coordinate, Y the width.
                m_ChronosMarks.Clear();
                m_TracksMarks.Clear();
                foreach (AbstractDrawing ad in m_Metadata.ExtraDrawings)
                {
                    DrawingChrono dc  = ad as DrawingChrono;
                    Track         trk = ad as Track;

                    if (dc != null)
                    {
                        if (dc.TimeStart != long.MaxValue && dc.TimeStop != long.MaxValue)
                        {
                            // todo: currently doesn't support the chrono without end.
                            // Only display chronometers that have at least something in the selection.
                            if (dc.TimeStart <= m_iMaximum && dc.TimeStop >= m_iMinimum)
                            {
                                long startTs = Math.Max(dc.TimeStart, m_iMinimum);
                                long stopTs  = Math.Min(dc.TimeStop, m_iMaximum);

                                int start = GetCoordFromTimestamp(startTs);
                                int stop  = GetCoordFromTimestamp(stopTs);

                                Point p = new Point(start, stop - start);

                                m_ChronosMarks.Add(p);
                            }
                        }
                    }
                    else if (trk != null)
                    {
                        if (trk.BeginTimeStamp <= m_iMaximum && trk.EndTimeStamp >= m_iMinimum)
                        {
                            long startTs = Math.Max(trk.BeginTimeStamp, m_iMinimum);
                            long stopTs  = Math.Min(trk.EndTimeStamp, m_iMaximum);

                            int start = GetCoordFromTimestamp(startTs);
                            int stop  = GetCoordFromTimestamp(stopTs);

                            Point p = new Point(start, stop - start);

                            m_TracksMarks.Add(p);
                        }
                    }
                }
            }

            // Sync point
            m_SyncPointMark = 0;
            if (m_SyncPointTimestamp != 0 && m_SyncPointTimestamp >= m_iMinimum && m_SyncPointTimestamp <= m_iMaximum)
            {
                m_SyncPointMark = GetCoordFromTimestamp(m_SyncPointTimestamp);
            }
        }
Esempio n. 10
0
 public CommandDeleteChrono(PlayerScreenUserInterface _psui, Metadata _Metadata)
 {
     m_psui     = _psui;
     m_Metadata = _Metadata;
     m_Chrono   = m_Metadata.ExtraDrawings[m_Metadata.SelectedExtraDrawing] as DrawingChrono;
 }