public StringKeyframeView(TLStringKeyframe kf, StringTrackView trackview) : base(kf, trackview) { //configure svg Background.ReferencedElement = new Uri("#" + Parent.Model.GetID() + "_KF", UriKind.Relative); Background.ID = "bg"; Background.CustomAttributes["class"] = "kf"; Background.MouseDown += Background_MouseDown; Background.MouseUp += Background_MouseUp; Background.MouseMove += Background_MouseMove; Label.FontSize = 12; Label.ID = "label"; Label.CustomAttributes["class"] = "skffont"; Label.Text = "text"; Label.Transforms = new SvgTransformCollection(); Label.Transforms.Add(new SvgScale(1, 1)); Label.Change += Label_Change; CollapsedView.ReferencedElement = new Uri("#" + Parent.Model.GetID() + "_CKF", UriKind.Relative); CollapsedView.ID = "fg"; CollapsedView.CustomAttributes["class"] = "ckf"; CollapsedView.MouseDown += Background_MouseDown; CollapsedView.MouseUp += Background_MouseUp; CollapsedView.MouseMove += Background_MouseMove; }
public TimelineView(TLDocument tl, ICommandHistory history, Timer timer) { History = history; History.CommandInserted += History_Changed; History.Undone += History_Changed; History.Redone += History_Changed; Document = tl; Timer = timer; //replace id manager before any svg element was added var caller = Document.Mapper.Map <ISvgEventCaller>(); var manager = new SvgIdManager(SvgRoot, caller, Document.Mapper.Map <RemoteContext>()); SvgRoot.ID = "svg"; SvgRoot.OverwriteIdManager(manager); Background.Width = new SvgUnit(SvgUnitType.Percentage, 100); Background.Height = 500; Background.ID = Document.GetID() + "_Background"; Background.Opacity = 0; Background.MouseDown += Default_MouseDown; Background.MouseMove += Default_MouseMove; Background.MouseUp += Default_MouseUp; Selection.ID = "Selection"; Selection.CustomAttributes["pointer-events"] = "none"; Selection.CustomAttributes["class"] = "selection"; Ruler = new RulerView(Document.Ruler, this); MouseTimeLine.ID = "MouseTime"; MouseTimeLine.StartX = 0; MouseTimeLine.StartY = 0; MouseTimeLine.EndX = 0; TimeBar.ID = "Timebar"; TimeBar.Y = -Ruler.Height; TimeBar.X = -1; TimeBar.Width = 2; TimeBar.MouseDown += Default_MouseDown; TimeBar.MouseMove += Default_MouseMove; TimeBar.MouseUp += Default_MouseUp; MainMenu = new SvgMenuWidget(120); MainMenu.ID = "MainMenu"; var addValueTrack = new SvgButtonWidget(0, 20, "Add Value Track"); addValueTrack.ValueChanged += AddValueTrack; var addStringTrack = new SvgButtonWidget(0, 20, "Add String Track"); addStringTrack.ValueChanged += AddStringTrack; MainMenu.AddItem(addValueTrack, 0); MainMenu.AddItem(addStringTrack, 1); FRulerGroup.ID = "Ruler"; FRulerGroup.CustomAttributes["class"] = "fixed"; FRulerGroup.Transforms = new SvgTransformCollection(); FRulerGroup.Transforms.Add(new SvgTranslate(0, 0)); FTrackGroup.ID = "Tracks"; FTrackGroup.Transforms = new SvgTransformCollection(); FOverlaysGroup.ID = "Overlays"; FOverlaysGroup.Transforms = new SvgTransformCollection(); //initialize svg tree BuildSVGRoot(); Syncer = Tracks.SyncWith(Document.Tracks, tm => { TrackView tv; if (tm is TLValueTrack) { tv = new ValueTrackView(tm as TLValueTrack, this, Ruler); } else if (tm is TLStringTrack) { tv = new StringTrackView(tm as TLStringTrack, this, Ruler); } else { tv = new AudioTrackView(tm as TLAudioTrack, this, Ruler); } if (ActiveTrack == null) { ActiveTrack = tv; } tv.AddToSceneGraphAt(FTrackGroup); //update Order on all tracks below the one added var order = tv.Model.Order.Value; foreach (var track in Tracks.Where(x => x.Model.Order.Value >= order)) { track.Model.Order.Value += 1; } return(tv); }, tv => { var order = tv.Model.Order.Value; tv.Dispose(); //update Order on all tracks below the one removed foreach (var track in Tracks.Where(x => x.Model.Order.Value > order)) { track.Model.Order.Value -= 1; } }); }