Beispiel #1
0
            /// <inheritdoc />
            public override void Hide()
            {
                if (!Visible)
                {
                    return;
                }

                Focus(null);

                if (_isDirty)
                {
                    if (_beforeData != null)
                    {
                        if (_undoContext is Track track)
                        {
                            var after = EditTrackAction.CaptureData(track);
                            if (!Utils.ArraysEqual(_beforeData, after))
                            {
                                _timeline.Undo.AddAction(new EditTrackAction(_timeline, track, _beforeData, after));
                            }
                        }
                        else if (_undoContext is Timeline)
                        {
                            var after = EditTimelineAction.CaptureData(_timeline);
                            if (!Utils.ArraysEqual(_beforeData, after))
                            {
                                _timeline.Undo.AddAction(new EditTimelineAction(_timeline, _beforeData, after));
                            }
                        }
                    }
                    _timeline.MarkAsEdited();
                }

                base.Hide();
            }
Beispiel #2
0
            public PropertiesEditPopup(Timeline timeline, object obj, object undoContext)
            {
                const float width  = 280.0f;
                const float height = 160.0f;

                Size = new Vector2(width, height);

                var panel1 = new Panel(ScrollBars.Vertical)
                {
                    Bounds = new Rectangle(0, 0.0f, width, height),
                    Parent = this
                };
                var editor = new CustomEditorPresenter(null);

                editor.Panel.AnchorPreset = AnchorPresets.HorizontalStretchTop;
                editor.Panel.IsScrollable = true;
                editor.Panel.Parent       = panel1;
                editor.Modified          += OnModified;

                editor.Select(obj);

                _timeline = timeline;
                if (timeline.Undo != null && timeline.Undo.Enabled && undoContext != null)
                {
                    _undoContext = undoContext;
                    if (undoContext is Track track)
                    {
                        _beforeData = EditTrackAction.CaptureData(track);
                    }
                    else if (undoContext is Timeline)
                    {
                        _beforeData = EditTimelineAction.CaptureData(timeline);
                    }
                }
            }