public override bool Execute(WindowState state)
        {
            var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve();

            if (inlineCurveEditor != null && inlineCurveEditor.inlineCurvesSelected)
            {
                FrameSelectedAction.FrameInlineCurves(inlineCurveEditor, state, false);
                return(true);
            }

            if (state.IsEditingASubItem())
            {
                return(false);
            }

            var w = state.GetWindow();

            if (w == null || w.treeView == null)
            {
                return(false);
            }

            var visibleTracks = w.treeView.visibleTracks.ToList();

            if (state.editSequence.asset != null && state.editSequence.asset.markerTrack != null)
            {
                visibleTracks.Add(state.editSequence.asset.markerTrack);
            }

            if (visibleTracks.Count == 0)
            {
                return(false);
            }

            var startTime = float.MaxValue;
            var endTime   = float.MinValue;

            foreach (var t in visibleTracks)
            {
                if (t == null)
                {
                    continue;
                }

                double trackStart, trackEnd;
                t.GetItemRange(out trackStart, out trackEnd);
                startTime = Mathf.Min(startTime, (float)trackStart);
                endTime   = Mathf.Max(endTime, (float)(trackEnd));
            }

            if (startTime != float.MinValue)
            {
                FrameSelectedAction.FrameRange(startTime, endTime, state);
                return(true);
            }

            return(false);
        }
        public override bool Execute(WindowState state)
        {
            var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve();

            if (inlineCurveEditor != null && inlineCurveEditor.inlineCurvesSelected)
            {
                FrameInlineCurves(inlineCurveEditor, state, true);
                return(true);
            }

            if (state.IsEditingASubItem())
            {
                return(false);
            }

            if (SelectionManager.Count() == 0)
            {
                return(false);
            }

            var startTime = float.MaxValue;
            var endTime   = float.MinValue;

            var clips   = SelectionManager.SelectedClipGUI();
            var markers = SelectionManager.SelectedMarkers();

            if (!clips.Any() && !markers.Any())
            {
                return(false);
            }

            foreach (var c in clips)
            {
                startTime = Mathf.Min(startTime, (float)c.clip.start);
                endTime   = Mathf.Max(endTime, (float)c.clip.end);
                if (c.clipCurveEditor != null)
                {
                    c.clipCurveEditor.FrameClip();
                }
            }

            foreach (var marker in markers)
            {
                startTime = Mathf.Min(startTime, (float)marker.time);
                endTime   = Mathf.Max(endTime, (float)marker.time);
            }

            FrameRange(startTime, endTime, state);

            return(true);
        }
        protected override bool ExecuteCommand(Event evt, WindowState state)
        {
            if (state.IsEditingASubItem())
            {
                return(false);
            }

            var consumed = false;
            var clips    = SelectionManager.SelectedClips();

            foreach (var clip in clips)
            {
                consumed |= ItemAction <TimelineClip> .HandleShortcut(state, evt, clip);
            }

            var markers = SelectionManager.SelectedMarkers();

            foreach (var marker in markers)
            {
                consumed |= ItemAction <IMarker> .HandleShortcut(state, evt, marker);
            }

            return(consumed);
        }