Esempio n. 1
0
        public StringTrackView(TLStringTrack track, TimelineView tv, RulerView rv)
            : base(track, tv, rv)
        {
            Keyframes = new EditableList <StringKeyframeView>();

            KFSyncer = Keyframes.SyncWith(Model.Keyframes,
                                          kf =>
            {
                var kv = new StringKeyframeView(kf, this);
                kf.NeighbourChanged += NeedsRebuild;
                var kfs              = Model.Keyframes.ToList();
                var prev             = kfs.FindLastIndex(x => x.Time.Value < kf.Time.Value);
                kv.AddToSceneGraphAt(KeyframeGroup, Keyframes.Count - 1 - prev);
                return(kv);
            },
                                          kv =>
            {
                kv.Dispose();
            });


            Background.Click += Background_MouseClick;

            KeyframeDefinition.StartX     = 0;
            KeyframeDefinition.StartY     = -25f;
            KeyframeDefinition.EndX       = 0;
            KeyframeDefinition.EndY       = 25f;
            KeyframeDefinition.ID         = Model.GetID() + "_KF";
            KeyframeDefinition.Transforms = new SvgTransformCollection();
            KeyframeDefinition.Transforms.Add(new SvgScale(1, 1));

            CollapsedKeyframeDefinition.ID         = Model.GetID() + "_CKF";
            CollapsedKeyframeDefinition.StartX     = 0;
            CollapsedKeyframeDefinition.StartY     = -25f;
            CollapsedKeyframeDefinition.EndX       = 0;
            CollapsedKeyframeDefinition.EndY       = 25f;
            CollapsedKeyframeDefinition.Transforms = new SvgTransformCollection();
            CollapsedKeyframeDefinition.Transforms.Add(new SvgScale(1, 1));

            KeyframeGroup.ID = "Keyframes";

            CurrentValue.FontSize = 12;
            CurrentValue.X        = 5;
            CurrentValue.CustomAttributes["class"]          = "trackfont";
            CurrentValue.CustomAttributes["pointer-events"] = "none";
            CurrentValue.Y = 24;

            UpdateScene();
        }
Esempio n. 2
0
        public AudioTrackView(TLAudioTrack track, TimelineView tv, RulerView rv)
            : base(track, tv, rv)
        {
//			SampleSyncer = Samples.SyncWith(Model.Samples,
//			                              s =>
//			                              {
//			                                var sv = new SampleView(s, this);
//			                                sv.BuildSVGTo(SampleGroup);
//			                                Model.Mapper.Map<AddContext>().DrawList.Add(sv);
//			                                return sv;
//			                              },
//			                              sv =>
//			                              {
//			                                Model.Mapper.Map<RemoveContext>().IDList.Add(sv.MainGroup.ID);
//			                                sv.Dispose();
//			                              });
//
            SampleDefinition.Width  = 5;
            SampleDefinition.Height = 1;
            SampleDefinition.ID     = "Sample";
//			SampleDefinition.Transforms = new SvgTransformCollection();
//			SampleDefinition.Transforms.Add(new SvgScale(1, 1));

            SampleGroup.ID = "Samples";

            Path.ID          = "path";
            Path.Stroke      = new SvgColourServer(Color.Gray);
            Path.StrokeWidth = 1.0f;
            Path.CustomAttributes["vector-effect"]  = "non-scaling-stroke";
            Path.CustomAttributes["pointer-events"] = "none";



//			Model.Minimum.ValueChanged += Model_Range_ValueChanged;
//			Model.Maximum.ValueChanged += Model_Range_ValueChanged;
//
//			MaxValue = new SvgValueWidget("Maximum", 1);
//			MaxValue.OnValueChanged += ChangeMaximum;
//			TrackMenu.AddItem(MaxValue);
//
//			MinValue = new SvgValueWidget("Minimum", -1);
//			MinValue.OnValueChanged += ChangeMinimum;
//			TrackMenu.AddItem(MinValue);
//
            UpdateScene();
        }
Esempio n. 3
0
 public PanZoomMenuHandler(TLViewBase view, string sessionID)
     : base(view, sessionID)
 {
     if (Instance is RulerView)
     {
         FRulerView    = Instance as RulerView;
         FTimelineView = FRulerView.Parent;
     }
     else if (Instance is TimelineView)
     {
         FTimelineView = Instance as TimelineView;
         FRulerView    = FTimelineView.Ruler;
     }
     else if (Instance is TrackView)
     {
         FTrackView    = Instance as TrackView;
         FTimelineView = FTrackView.Parent;
         FRulerView    = FTimelineView.Ruler;
     }
 }
Esempio n. 4
0
        public Timeliner(TLContext context)
        {
            Context = context;

            TimelineModel       = new TLDocument("", @"timeline.xml");
            Shell.Instance.Root = TimelineModel;

            TimelineModel.CreateMapper(context.MappingRegistry);
            //only after mapper and root are set
            TimelineModel.Initialize();

            var commandHistory = TimelineModel.Mapper.Map <ICommandHistory>();

            TimelineView = new TimelineView(TimelineModel, commandHistory, Timer);

            TimelineModel.Tracks.Added        += Timeline_Tracks_Added;
            TimelineModel.Tracks.Removed      += Timeline_Tracks_Removed;
            TimelineModel.Tracks.OrderChanged += Timeline_Tracks_OrderChanged;

            TimelineView.Tracks.OrderChanged += TimelineView_Tracks_OrderChanged;
        }
Esempio n. 5
0
        public TrackView(TLTrackBase track, TimelineView tv, RulerView rv)
            : base(track, tv)
        {
            Model  = track;
            Parent = tv;
            FRuler = rv;

            MainGroup.Transforms = new SvgTransformCollection();
            MainGroup.Transforms.Add(new SvgTranslate(0, 0));

            var width = new SvgUnit(SvgUnitType.Percentage, 100);

            Label.FontSize   = 12;
            Label.X          = 5;
            Label.Y          = Label.FontSize;
            Label.Text       = Model.Label.Value;
            Label.ID         = "label";
            Label.MouseDown += Background_MouseDown;
            Label.MouseUp   += Background_MouseUp;
            Label.CustomAttributes["class"] = "trackfont";

            SizeBarDragRect.FillOpacity = 0.3f;
            SizeBarDragRect.Visible     = false;
            SizeBarDragRect.CustomAttributes["pointer-events"] = "none";

            Background.Width  = width;
            Background.Height = 1;             // this is the value range, not the actual track size
            Background.ID     = "bg";

            ClipRect.Width  = width;
            ClipRect.Height = Background.Height;
            ClipRect.ID     = "ClipRect";

            //document roots id is "svg". this is where the trackclips are added to
            TrackClipPath.ID = "svg_clip" + IDGenerator.NewID;
            TrackClipPath.Children.Add(ClipRect);

            TrackGroup.ID         = "Clip";
            TrackGroup.Transforms = new SvgTransformCollection();
            TrackGroup.Transforms.Add(new SvgScale(1, 1));
            var uri = new Uri("url(#" + TrackClipPath.ID + ")", UriKind.Relative);

            TrackGroup.ClipPath = uri;

            PanZoomGroup.ID         = "PanZoom";
            PanZoomGroup.Transforms = new SvgTransformCollection();
            PanZoomGroup.Transforms.Add(FRuler.PanZoomMatrix);            //pan/zoom
            PanZoomGroup.Transforms.Add(new SvgTranslate(0));             //min/max

            SizeBar.Width  = width;
            SizeBar.Height = 3;
            SizeBar.ID     = "SizeBar";
            SizeBar.CustomAttributes["class"] = "sizebar";
            SizeBar.Y = Background.Height.Value;

            //register event handlers
            Background.MouseDown += Background_MouseDown;
            Background.MouseUp   += Background_MouseUp;
            Background.MouseMove += Background_MouseMove;

            SizeBar.MouseDown += Background_MouseDown;
            SizeBar.MouseMove += Background_MouseMove;
            SizeBar.MouseUp   += Background_MouseUp;

            CreateTrackMenu();
            CreateKeyframeMenu();
        }
Esempio n. 6
0
        public RulerView(TLRuler ruler, TimelineView tv)
            : base(ruler, tv)
        {
            Model  = ruler;
            Parent = tv;

            PanZoomMatrix = new SvgMatrix(FView.Elements.ToList());

            MainGroup.Transforms = new SvgTransformCollection();
            MainGroup.Transforms.Add(new SvgTranslate(0, 0));

            var width = new SvgUnit(SvgUnitType.Percentage, 100);

            Background.Width  = width;
            Background.Height = 25;
            Background.ID     = "bg";
            Background.CustomAttributes["class"] = "ruler";

            //register event handlers
            Background.MouseDown += Background_MouseDown;
            Background.MouseUp   += Background_MouseUp;
            Background.MouseMove += Background_MouseMove;

            var caller = Parent.Document.Mapper.Map <ISvgEventCaller>();

            PlayButton   = SvgDocumentWidget.Load(Path.Combine(TimelineView.ResourcePath, "PlayButton.svg"), caller, 2);
            StopButton   = SvgDocumentWidget.Load(Path.Combine(TimelineView.ResourcePath, "StopButton.svg"), caller, 1);
            StopButton.X = 25;

            PlayButton.Click += PlayButton_Click;
            StopButton.Click += StopButton_Click;

            TimeCodeLabelBackground.Width  = CLeftOffset;
            TimeCodeLabelBackground.Height = Background.Height;
            TimeCodeLabelBackground.CustomAttributes["class"] = "ruler";
            TimeCodeLabelBackground.MouseDown += Background_MouseDown;

            TimeCodeLabel.FontSize = 20;
            TimeCodeLabel.X        = 55;
            TimeCodeLabel.Y        = TimeCodeLabel.FontSize;
            TimeCodeLabel.CustomAttributes["class"] = "time";
            TimeCodeLabel.ID   = Model.GetID() + "_label";
            TimeCodeLabel.Text = "00:00:00:000";
            TimeCodeLabel.CustomAttributes["class"] = "time";
            TimeCodeLabel.MouseDown += Background_MouseDown;

            SizeBar.Width      = Background.Width;
            SizeBar.Height     = 10;
            SizeBar.ID         = "SizeBar";
            SizeBar.Y          = Background.Height;
            SizeBar.MouseDown += Background_MouseDown;
            SizeBar.MouseMove += Background_MouseMove;
            SizeBar.MouseUp   += Background_MouseUp;

            MouseTimeLabel.ID       = "MouseTimeLabel";
            MouseTimeLabel.Y        = Height;
            MouseTimeLabel.FontSize = 14;

            ClipRect.Width  = width;
            ClipRect.Height = Height;
            ClipRect.ID     = "ClipRect";

            //document roots id is "svg". this is where the trackclips are added to
            RulerClipPath.ID = "svg_clip" + IDGenerator.NewID;
            RulerClipPath.Children.Add(ClipRect);

            var uri = new Uri("url(#" + RulerClipPath.ID + ")", UriKind.Relative);

            MainGroup.ClipPath = uri;

            NumberGroup.ID         = "Ticks";
            NumberGroup.Transforms = new SvgTransformCollection();
            NumberGroup.Transforms.Add(PanZoomMatrix);

            PanZoomGroup.ID         = "PanZoom";
            PanZoomGroup.Transforms = new SvgTransformCollection();
            PanZoomGroup.Transforms.Add(PanZoomMatrix);

            for (int i = 0; i < 70; i++)
            {
                var num = new SvgText(i.ToString());
                num.FontSize = 20;
                num.Y        = num.FontSize;
                num.CustomAttributes["class"] = "time hair";
                num.Transforms = new SvgTransformCollection();
                num.Transforms.Add(new SvgTranslate(i));
                num.Transforms.Add(new SvgScale(1 / Timer.PPS, 1));
                NumberGroup.Children.Add(num);
            }

            LoopRegion.ID          = "LoopRegion";
            LoopRegion.Y           = Background.Height / 4;
            LoopRegion.Height      = Background.Height / 2;
            LoopRegion.FillOpacity = 0.7f;
            LoopRegion.CustomAttributes["pointer-events"] = "fill";
            LoopRegion.CustomAttributes["class"]          = "loop";
            LoopRegion.MouseDown += Background_MouseDown;
            LoopRegion.MouseUp   += Parent.Default_MouseUp;
            LoopRegion.MouseMove += Parent.Default_MouseMove;
            PanZoomGroup.Children.Add(LoopRegion);

            LoopStart.ID     = "LoopStart";
            LoopStart.Width  = 1 / Timer.PPS * CHandlerWidth;
            LoopStart.Height = Background.Height;
            PanZoomGroup.Children.Add(LoopStart);
            LoopStart.MouseDown += Background_MouseDown;
            LoopStart.MouseUp   += Parent.Default_MouseUp;
            LoopStart.MouseMove += Parent.Default_MouseMove;
            LoopStart.CustomAttributes["pointer-events"] = "fill";
            LoopStart.CustomAttributes["class"]          = "loopcap";

            LoopEnd.ID     = "LoopEnd";
            LoopEnd.Width  = 1 / Timer.PPS * CHandlerWidth;
            LoopEnd.Height = Background.Height;
            PanZoomGroup.Children.Add(LoopEnd);
            LoopEnd.MouseDown += Background_MouseDown;
            LoopEnd.MouseUp   += Parent.Default_MouseUp;
            LoopEnd.MouseMove += Parent.Default_MouseMove;
            LoopEnd.CustomAttributes["pointer-events"] = "fill";
            LoopEnd.CustomAttributes["class"]          = "loopcap";

            CreateMenu();

            //init scalings
            PanZoom(0, 0, 0);
            UpdateScene();
        }
Esempio n. 7
0
        public ValueTrackView(TLValueTrack track, TimelineView tv, RulerView rv)
            : base(track, tv, rv)
        {
            Keyframes = new EditableList <ValueKeyframeView>();

            KFSyncer = Keyframes.SyncWith(Model.Keyframes,
                                          kf =>
            {
                var kv = new ValueKeyframeView(kf, this);
                kf.NeighbourChanged += NeedsRebuild;
                var kfs              = Model.Keyframes.ToList();
                var prev             = kfs.FindLastIndex(x => x.Time.Value < kf.Time.Value);
                kv.AddToSceneGraphAt(KeyframeGroup, Keyframes.Count - 1 - prev);
                return(kv);
            },
                                          kv =>
            {
                kv.Model.NeighbourChanged -= NeedsRebuild;
                kv.Dispose();
            });

            CurveSyncer = Curves.SyncWith(Model.Curves,
                                          cu =>
            {
                var cv = new CurveView(cu, this);
                cv.AddToSceneGraphAt(CurveGroup);
                return(cv);
            },
                                          cv =>
            {
                cv.Dispose();
            }
                                          );

            Background.Click += Background_MouseClick;

            KeyframeDefinition.CenterX    = 0;
            KeyframeDefinition.CenterY    = 0;
            KeyframeDefinition.Radius     = 3;
            KeyframeDefinition.ID         = Model.GetID() + "_KF";
            KeyframeDefinition.Transforms = new SvgTransformCollection();
            KeyframeDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseNoneDefinition.ID         = Model.GetID() + "_NE";
            EaseNoneDefinition.StartX     = 0;
            EaseNoneDefinition.StartY     = -25f;
            EaseNoneDefinition.EndX       = 0;
            EaseNoneDefinition.EndY       = 25f;
            EaseNoneDefinition.Transforms = new SvgTransformCollection();
            EaseNoneDefinition.Transforms.Add(new SvgScale(1, 1));

            var half = Model.CCollapsedHeight / 2f;

            EaseInDefinition.ID     = Model.GetID() + "_EI";
            EaseInDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseInDefinition, new PointF(0, -half));
            AddPoint(EaseInDefinition, new PointF(-half, 0));
            AddPoint(EaseInDefinition, new PointF(0, half));
            EaseInDefinition.Transforms = new SvgTransformCollection();
            EaseInDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseOutDefinition.ID     = Model.GetID() + "_EO";
            EaseOutDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseOutDefinition, new PointF(0, -half));
            AddPoint(EaseOutDefinition, new PointF(half, 0));
            AddPoint(EaseOutDefinition, new PointF(0, half));
            EaseOutDefinition.Transforms = new SvgTransformCollection();
            EaseOutDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseInOutDefinition.ID     = Model.GetID() + "_EIO";
            EaseInOutDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseInOutDefinition, new PointF(0, -half));
            AddPoint(EaseInOutDefinition, new PointF(half, 0));
            AddPoint(EaseInOutDefinition, new PointF(0, half));
            AddPoint(EaseInOutDefinition, new PointF(-half, 0));
            EaseInOutDefinition.Transforms = new SvgTransformCollection();
            EaseInOutDefinition.Transforms.Add(new SvgScale(1, 1));

            CurveGroup.ID    = "Curves";
            KeyframeGroup.ID = "Keyframes";

            CurrentValue.FontSize = 12;
            CurrentValue.X        = 5;
            CurrentValue.CustomAttributes["class"]          = "trackfont";
            CurrentValue.CustomAttributes["pointer-events"] = "none";
            CurrentValue.Y = 24;

            UpdateScene();
        }