void AddStringTrack(SvgWidget widget, object newValue, object delta)
        {
            var track = new TLStringTrack(FTrackCount++.ToString());

            track.Order.Value = Document.Tracks.Count;
            History.Insert(Command.Add(Document.Tracks, track));
        }
Exemple #2
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();
        }
        protected TLTrackBase CreateTrack(string tag, string name)
        {
            TLTrackBase result = null;

            if (tag == "ValueTrack")
            {
                result = new TLValueTrack(name);
            }
            else if (tag == "StringTrack")
            {
                result = new TLStringTrack(name);
            }

            return(result);
        }
        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();
        }