예제 #1
0
        private void SetHighlightedTrack(EventFrame frame)
        {
            if (fHighlightedFrame != frame)
            {
                fHighlightedFrame = frame;

                fToolTipText = new List <string>();
                if (fHighlightedFrame != null)
                {
                    fToolTipText.Add(fHighlightedFrame.Name);
                    fToolTipText.Add(fHighlightedFrame.Start.ToString());
                    fToolTipText.Add(fHighlightedFrame.End.ToString());
                    fToolTip.Show(".", this);
                }
                else
                {
                    fToolTip.Hide(this);
                }

                Invalidate();
            }
        }
예제 #2
0
 /// <summary>
 ///   Construct a new Track.
 /// </summary>
 /// <param name="track">The timeline track that should be wrapped.</param>
 public Track(EventFrame track) : this()
 {
     fFrames.Add(track);
     Name = track.Name;
 }
예제 #3
0
        /// <summary>
        ///   Invoked when the user presses a mouse button over the control.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (!Focused)
            {
                Focus();
            }

            // Store the current mouse position.
            Point location = new Point(e.X, e.Y);

            if ((e.Button & MouseButtons.Left) != 0)
            {
                // Check if there is a track at the current mouse position.
                EventFrame focusedFrame = HitTest(location);

                if (focusedFrame != null)
                {
                    // Was this track already selected?
                    if (!fSelectedFrames.Contains(focusedFrame))
                    {
                        // Tell the track that it was selected.
                        InvokeSelectionChanged(new SelectionChangedEventArgs(focusedFrame.Yield <ITimeObject>(), null));
                        // Clear the selection, unless the user is picking
                        if ((ModifierKeys & Keys.Control) == 0)
                        {
                            InvokeSelectionChanged(new SelectionChangedEventArgs(null, (IEnumerable <ITimeObject>)fSelectedFrames));
                            fSelectedFrames.Clear();
                        }

                        // Add track to selection
                        fSelectedFrames.Add(focusedFrame);

                        // If the track was already selected and Ctrl is down
                        // then the user is picking and we want to remove the track from the selection
                    }
                    else if ((ModifierKeys & Keys.Control) != 0)
                    {
                        fSelectedFrames.Remove(focusedFrame);
                        InvokeSelectionChanged(new SelectionChangedEventArgs(null, focusedFrame.Yield <ITimeObject>()));
                    }
                }
                else if (location.Y < fPlayheadExtents.Height)
                {
                    fCurrentMode = BehaviorMode.TimeScrub;
                    SetClockFromMousePosition(location);
                }
                else
                {
                    // Clear the selection, unless the user is picking
                    if ((ModifierKeys & Keys.Control) == 0)
                    {
                        InvokeSelectionChanged(new SelectionChangedEventArgs(null, (IEnumerable <ITimeObject>)fSelectedFrames));
                        fSelectedFrames.Clear();
                    }

                    // Remember this location as the origin for the selection.
                    fSelectionOrigin = location;
                    fCurrentMode     = BehaviorMode.Selecting;
                }
            }
            else if ((e.Button & MouseButtons.Middle) != 0)
            {
                fPanOrigin = location;
                fRenderingOffsetBeforePan = fRenderingOffset;
            }

            Invalidate();
        }
예제 #4
0
 /// <summary>
 ///   Retrieve the index of the track of a given frame.
 /// </summary>
 /// <param name="frame">The frame for which to retrieve the index.</param>
 /// <returns>The index of the track or the index the track is a substitute for.</returns>
 private int GetTrackIndexForFrame(EventFrame frame)
 {
     return(fTracks.FindIndex(t => t.Frames.Contains(frame)));
 }
예제 #5
0
 /// <summary>
 ///   Add an event frame to the timeline.
 /// </summary>
 /// <param name="eventFrame">The event frame to add.</param>
 public void AddEventFrame(EventFrame eventFrame)
 {
     fTracks.Add(new Track(eventFrame));
     Recalculate();
     Invalidate();
 }