コード例 #1
0
ファイル: TrackView.cs プロジェクト: yousafgill/Timeliner
        void CreateTrackMenu()
        {
            TrackMenu = new SvgMenuWidget(110);

            CollapseButton = new SvgButtonWidget(0, 20, "Collapse");
            CollapseButton.ValueChanged += CollapseTrack;
            TrackMenu.AddItem(CollapseButton, 1);

            //get all [MenuEntry] properties of Model
            var props = Model.GetType().GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(TrackMenuEntryAttribute)));

            foreach (var p in props)
            {
                var attributes = p.GetCustomAttributes(true);
                var menuEntry  = (attributes[0] as TrackMenuEntryAttribute);

                //get an editor for the property
                var editor = WidgetFactory.GetWidget(Model, p, 0, menuEntry.Height);
                editor.ValueChanged += ChangeTrackMenuEntry;

                TrackMenuDict.Add(editor, Model);

                //add it to the TrackMenu
                TrackMenu.AddItem(editor, menuEntry.Order);
            }

            RemoveButton = new SvgButtonWidget(0, 20, "Remove");
            RemoveButton.ValueChanged += RemoveTrack;
            TrackMenu.AddItem(RemoveButton, 4);
        }
コード例 #2
0
ファイル: TrackView.cs プロジェクト: yousafgill/Timeliner
        void CreateKeyframeMenu()
        {
            KeyframeMenu = new SvgMenuWidget(110);

            //get all [MenuEntry] properties of Model
            IEnumerable <PropertyInfo> props = new List <PropertyInfo>();

            if (this is ValueTrackView)
            {
                props = typeof(TLValueKeyframe).GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(KeyframeMenuEntryAttribute)));
            }
            else if (this is StringTrackView)
            {
                props = typeof(TLStringKeyframe).GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(KeyframeMenuEntryAttribute)));
            }

            foreach (var p in props)
            {
                var attributes = p.GetCustomAttributes(true);
                var menuEntry  = (attributes[0] as KeyframeMenuEntryAttribute);

                //get an editor for the property
                var editor = WidgetFactory.GetWidget(null, p, 0, menuEntry.Height);
                editor.ValueChanged += ChangeKeyframeMenuEntry;

                //add it to the TrackMenu
                KeyframeMenu.AddItem(editor, menuEntry.Order);
            }
        }
コード例 #3
0
ファイル: RulerView.cs プロジェクト: yousafgill/Timeliner
        void CreateMenu()
        {
            Menu = new SvgMenuWidget(125);

            //get all [MenuEntry] properties of Model
            var props = Model.GetType().GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(TrackMenuEntryAttribute)));

            foreach (var p in props)
            {
                var attributes = p.GetCustomAttributes(true);
                var menuEntry  = (attributes[0] as TrackMenuEntryAttribute);

                //get an editor for the property
                var editor = WidgetFactory.GetWidget(Model, p, 0, menuEntry.Height);
                editor.ValueChanged += ChangeTrackMenuEntry;

                TrackMenuDict.Add(editor, Model);

                //add it to the TrackMenu
                Menu.AddItem(editor, menuEntry.Order);
            }
        }
コード例 #4
0
ファイル: RulerView.cs プロジェクト: stahlnow/Timeliner
        void CreateMenu()
        {
            Menu = new SvgMenuWidget(125);

            //get all [MenuEntry] properties of Model
            var props = Model.GetType().GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(TrackMenuEntryAttribute)));
            foreach (var p in props)
            {
                var attributes = p.GetCustomAttributes(true);
                var menuEntry = (attributes[0] as TrackMenuEntryAttribute);

                //get an editor for the property
                var editor = WidgetFactory.GetWidget(Model, p, 0, menuEntry.Height);
                editor.ValueChanged += ChangeTrackMenuEntry;

                TrackMenuDict.Add(editor, Model);

                //add it to the TrackMenu
                Menu.AddItem(editor, menuEntry.Order);
            }
        }
コード例 #5
0
ファイル: TimelinerView.cs プロジェクト: yousafgill/Timeliner
        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;
                }
            });
        }
コード例 #6
0
ファイル: TrackView.cs プロジェクト: stahlnow/Timeliner
        void CreateTrackMenu()
        {
            TrackMenu = new SvgMenuWidget(110);

            CollapseButton = new SvgButtonWidget(0, 20, "Collapse");
            CollapseButton.ValueChanged += CollapseTrack;
            TrackMenu.AddItem(CollapseButton, 1);

            //get all [MenuEntry] properties of Model
            var props = Model.GetType().GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(TrackMenuEntryAttribute)));
            foreach (var p in props)
            {
                var attributes = p.GetCustomAttributes(true);
                var menuEntry = (attributes[0] as TrackMenuEntryAttribute);

                //get an editor for the property
                var editor = WidgetFactory.GetWidget(Model, p, 0, menuEntry.Height);
                editor.ValueChanged += ChangeTrackMenuEntry;

                TrackMenuDict.Add(editor, Model);

                //add it to the TrackMenu
                TrackMenu.AddItem(editor, menuEntry.Order);
            }

            RemoveButton = new SvgButtonWidget(0, 20, "Remove");
            RemoveButton.ValueChanged += RemoveTrack;
            TrackMenu.AddItem(RemoveButton, 4);
        }
コード例 #7
0
ファイル: TrackView.cs プロジェクト: stahlnow/Timeliner
        void CreateKeyframeMenu()
        {
            KeyframeMenu = new SvgMenuWidget(110);

            //get all [MenuEntry] properties of Model
            IEnumerable<PropertyInfo> props = new List<PropertyInfo>();
            if (this is ValueTrackView)
                props = typeof(TLValueKeyframe).GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(KeyframeMenuEntryAttribute)));
            else if (this is StringTrackView)
                props = typeof(TLStringKeyframe).GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(KeyframeMenuEntryAttribute)));

            foreach (var p in props)
            {
                var attributes = p.GetCustomAttributes(true);
                var menuEntry = (attributes[0] as KeyframeMenuEntryAttribute);

                //get an editor for the property
                var editor = WidgetFactory.GetWidget(null, p, 0, menuEntry.Height);
                editor.ValueChanged += ChangeKeyframeMenuEntry;

                //add it to the TrackMenu
                KeyframeMenu.AddItem(editor, menuEntry.Order);
            }
        }