Example #1
0
 void Timeline_Tracks_Added(IViewableCollection<TLTrackBase> collection, TLTrackBase item)
 {
     item.Label.ValueChanged += item_Label_ValueChanged;
     if (TrackAdded != null)
         TrackAdded(item.Label.Value, item.Order.Value);
 }
Example #2
0
 void Timeline_Tracks_Removed(IViewableCollection<TLTrackBase> collection, TLTrackBase item)
 {
     item.Label.ValueChanged -= item_Label_ValueChanged;
     if (TrackRemoved != null)
         TrackRemoved(item.Label.Value);
 }
Example #3
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();
        }