Beispiel #1
0
 /// <summary>
 ///     Creates a new command to select the given keys. You can pass null to deselect all.
 /// </summary>
 public AddKeyCommand(CurveEditorControl2 control, long curveId, float position, float value)
     : base(control) {
     _curveId = curveId;
     KeyId = -1;
     _position = position;
     _value = value;
 }
Beispiel #2
0
        public ScaleKeysCommand(CurveEditorControl2 control, Point min, Point max, ScaleBoxHandle handle)
            : base(control)
        {
            // Store the parameters.
            _min    = min;
            _max    = max;
            _newMin = min;
            _newMax = max;
            _handle = handle;

            // Store the current selection, if any.
            _affectedKeys  = new long[control.Selection.Count];
            _normalizedPos = new Point[control.Selection.Count];
            var i = 0;

            foreach (var key in control.Selection)
            {
                _affectedKeys[i] = key.Id;

                var pos = key.GetPosition();
                _normalizedPos[i].X = (pos.X - min.X) / (max.X - min.X);
                _normalizedPos[i].Y = (pos.Y - min.Y) / (max.Y - min.Y);

                i++;
            }
        }
 public CurveEditorControlsViewModel(CurveEditorControl2 control)
 {
     Control = control;
     Control.ToolModeChanged   += Control_ToolModeChanged;
     Control.SelectionChanged  += Control_SelectionChanged;
     Control.SelectedKeysMoved += Control_SelectedKeysMoved;
 }
 public CurveEditorControlsViewModel(CurveEditorControl2 control)
 {
     Control = control;
     Control.ToolModeChanged += Control_ToolModeChanged;
     Control.SelectionChanged += Control_SelectionChanged;
     Control.SelectedKeysMoved += Control_SelectedKeysMoved;
 }
Beispiel #5
0
        /// <summary>
        /// Creates a new command to scale a set of keys.
        /// </summary>
        /// <param name="min">The minimum position of the scale box grabbing all selected keys</param>
        /// <param name="max">The maximum position of the scale box grabbing all selected keys</param>
        public ScaleKeysCommand(CurveEditorControl2 control, Point min, Point max, ScaleBoxHandle handle)
            : base(control)
        {
            // Store the parameters.
            this.min    = min;
            this.max    = max;
            this.newMin = min;
            this.newMax = max;
            this.handle = handle;

            // Store the current selection, if any.
            affectedKeys  = new long[control.Selection.Count];
            normalizedPos = new Point[control.Selection.Count];
            int i = 0;

            foreach (KeyWrapper key in control.Selection)
            {
                affectedKeys[i] = key.Id;

                Point pos = key.GetPosition();
                normalizedPos[i].X = (pos.X - min.X) / (max.X - min.X);
                normalizedPos[i].Y = (pos.Y - min.Y) / (max.Y - min.Y);

                i++;
            }
        }
 public SetBothTangentsCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, KeyTangentMode tangentMode)
 {
     _control          = control;
     _viewModel        = viewModel;
     _tangentMode      = tangentMode;
     CanExecuteChanged = delegate { };
 }
Beispiel #7
0
 public CurveEditorControlsViewModel(CurveEditorControl2 control)
 {
     this.Control = control;
     this.Control.ToolModeChanged   += new EventHandler(Control_ToolModeChanged);
     this.Control.SelectionChanged  += new EventHandler(Control_SelectionChanged);
     this.Control.SelectedKeysMoved += new EventHandler(Control_SelectedKeysMoved);
 }
Beispiel #8
0
 public ZoomCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, float xFactor, float yFactor)
 {
     this.control   = control;
     this.viewModel = viewModel;
     this.xFactor   = xFactor;
     this.yFactor   = yFactor;
 }
Beispiel #9
0
 /// <summary>
 ///     Creates a new command to select the given keys. You can pass null to deselect all.
 /// </summary>
 public AddKeyCommand(CurveEditorControl2 control, long curveId, float position, float value)
     : base(control)
 {
     _curveId  = curveId;
     KeyId     = -1;
     _position = position;
     _value    = value;
 }
 public ZoomCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, float xFactor, float yFactor)
 {
     _control          = control;
     _viewModel        = viewModel;
     _xFactor          = xFactor;
     _yFactor          = yFactor;
     CanExecuteChanged = delegate { };
 }
            public ZoomExtentsCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, bool selectionOnly)
            {
                _control       = control;
                _viewModel     = viewModel;
                _selectionOnly = selectionOnly;

                control.SelectionChanged += control_SelectionChanged;
            }
Beispiel #12
0
 /// <summary>
 /// Creates a new command to select the given keys. You can pass null to deselect all.
 /// </summary>
 public AddKeyCommand(CurveEditorControl2 control, long curveId, float position, float value)
     : base(control)
 {
     this.curveId  = curveId;
     this.keyId    = -1;
     this.position = position;
     this.value    = value;
 }
Beispiel #13
0
            public ZoomExtentsCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, bool selectionOnly)
            {
                this.control       = control;
                this.viewModel     = viewModel;
                this.selectionOnly = selectionOnly;

                control.SelectionChanged += new EventHandler(control_SelectionChanged);
            }
        /// <summary>
        ///     Creates a new command to select the given keys. You can pass null to deselect all.
        /// </summary>
        public ChangeContinuityCommand(CurveEditorControl2 control, CurveContinuity newKeyContinuity)
            : base(control)
        {
            // Store the parameters.
            this.newKeyContinuity = newKeyContinuity;

            // Store the current selection, if any.
            affectedKeys = new long[control.Selection.Count];
            var i = 0;
            foreach (var key in control.Selection) {
                affectedKeys[i++] = key.Id;
            }
        }
Beispiel #15
0
        /// <summary>
        /// Creates a new command to select the given keys. You can pass null to deselect all.
        /// </summary>
        public ChangeTangentCommand(CurveEditorControl2 control, long keyId, TangentSelectionMode selectedTangent)
            : base(control)
        {
            // Store the parameters.
            this.selectedTangent = selectedTangent;
            this.affectedKey     = keyId;

            KeyWrapper key = control.Keys[keyId];

            prevTangentInValue  = key.Key.TangentIn;
            prevTangentOutValue = key.Key.TangentOut;
            prevTangentInMode   = key.TangentInMode;
            prevTangentOutMode  = key.TangentOutMode;
        }
        /// <summary>
        ///     Creates a new command to select the given keys. You can pass null to deselect all.
        /// </summary>
        public ChangeTangentModeCommand(CurveEditorControl2 control, KeyTangentMode? newTangentInMode, KeyTangentMode? newTangentOutMode)
            : base(control)
        {
            // Store the parameters.
            _newTangentInMode = newTangentInMode;
            _newTangentOutMode = newTangentOutMode;

            // Store the current selection, if any.
            _affectedKeys = new long[control.Selection.Count];
            var i = 0;
            foreach (var key in control.Selection) {
                _affectedKeys[i++] = key.Id;
            }
        }
        /// <summary>
        /// Creates a new command to select the given keys. You can pass null to deselect all.
        /// </summary>
        public ChangeTangentCommand(CurveEditorControl2 control, long keyId, TangentSelectionMode selectedTangent)
            : base(control)
        {
            // Store the parameters.
            this.selectedTangent = selectedTangent;
            this.affectedKey = keyId;

            KeyWrapper key = control.Keys[keyId];

            prevTangentInValue = key.Key.TangentIn;
            prevTangentOutValue = key.Key.TangentOut;
            prevTangentInMode = key.TangentInMode;
            prevTangentOutMode = key.TangentOutMode;
        }
Beispiel #18
0
        /// <summary>
        ///     Creates a new command to move a set of keys.
        /// </summary>
        public MoveKeysCommand(CurveEditorControl2 control, float positionOffset, float valueOffset)
            : base(control)
        {
            // Store the parameters.
            _positionOffset = positionOffset;
            _valueOffset = valueOffset;

            // Store the current selection, if any.
            _affectedKeys = new long[control.Selection.Count];
            var i = 0;
            foreach (var key in control.Selection) {
                _affectedKeys[i++] = key.Id;
            }
        }
Beispiel #19
0
        /// <summary>
        ///     Creates a new command to select the given keys. You can pass null to deselect all.
        /// </summary>
        public ChangeContinuityCommand(CurveEditorControl2 control, CurveContinuity newKeyContinuity)
            : base(control)
        {
            // Store the parameters.
            this.newKeyContinuity = newKeyContinuity;

            // Store the current selection, if any.
            affectedKeys = new long[control.Selection.Count];
            var i = 0;

            foreach (var key in control.Selection)
            {
                affectedKeys[i++] = key.Id;
            }
        }
Beispiel #20
0
        /// <summary>
        /// Creates a new command to move a set of keys.
        /// </summary>
        public MoveKeysCommand(CurveEditorControl2 control, float positionOffset, float valueOffset)
            : base(control)
        {
            // Store the parameters.
            this.positionOffset = positionOffset;
            this.valueOffset    = valueOffset;

            // Store the current selection, if any.
            affectedKeys = new long[control.Selection.Count];
            int i = 0;

            foreach (KeyWrapper key in control.Selection)
            {
                affectedKeys[i++] = key.Id;
            }
        }
        /// <summary>
        /// Creates a new command to select the given keys. You can pass null to deselect all.
        /// </summary>
        public ChangeTangentModeCommand(CurveEditorControl2 control, KeyTangentMode?newTangentInMode, KeyTangentMode?newTangentOutMode)
            : base(control)
        {
            // Store the parameters.
            this.newTangentInMode  = newTangentInMode;
            this.newTangentOutMode = newTangentOutMode;

            // Store the current selection, if any.
            affectedKeys = new long[control.Selection.Count];
            int i = 0;

            foreach (KeyWrapper key in control.Selection)
            {
                affectedKeys[i++] = key.Id;
            }
        }
Beispiel #22
0
        /// <summary>
        ///     Creates a new command to move a set of keys.
        /// </summary>
        public MoveKeysCommand(CurveEditorControl2 control, float positionOffset, float valueOffset)
            : base(control)
        {
            // Store the parameters.
            _positionOffset = positionOffset;
            _valueOffset    = valueOffset;

            // Store the current selection, if any.
            _affectedKeys = new long[control.Selection.Count];
            var i = 0;

            foreach (var key in control.Selection)
            {
                _affectedKeys[i++] = key.Id;
            }
        }
Beispiel #23
0
        /// <summary>
        /// Creates a new command to select the given keys. You can pass null to deselect all.
        /// </summary>
        public SelectKeysCommand(CurveEditorControl2 control, IList <long> keysToSelect)
            : base(control)
        {
            int count = 0;

            // Store the new selection, if any.
            if (keysToSelect != null)
            {
                count = keysToSelect.Count;
            }
            newSelection = new long[count];
            for (int i = 0; i < count; i++)
            {
                newSelection[i] = keysToSelect[i];
            }
        }
Beispiel #24
0
        public CurveWrapper(Curve curve, String name, CurveEditorControl2 control, Color color)
        {
            _visible = true;
            Curve = curve;
            Id = LatestId++;
            Name = name;
            Control = control;

            ColorBrush = new SolidColorBrush(color);
            ColorBrush.Freeze();

            Pen = new Pen(ColorBrush, 1);
            Pen.EndLineCap = PenLineCap.Round;
            Pen.StartLineCap = PenLineCap.Round;
            Pen.Freeze();

            DashedPen = new Pen(ColorBrush, 0.5);
            DashedPen.Freeze();
        }
Beispiel #25
0
        public CurveWrapper(Curve curve, String name, CurveEditorControl2 control, Color color)
        {
            _visible = true;
            Curve    = curve;
            Id       = LatestId++;
            Name     = name;
            Control  = control;

            ColorBrush = new SolidColorBrush(color);
            ColorBrush.Freeze();

            Pen              = new Pen(ColorBrush, 1);
            Pen.EndLineCap   = PenLineCap.Round;
            Pen.StartLineCap = PenLineCap.Round;
            Pen.Freeze();

            DashedPen = new Pen(ColorBrush, 0.5);
            DashedPen.Freeze();
        }
Beispiel #26
0
        public CurveWrapper(Curve curve, String name, CurveEditorControl2 control, System.Windows.Media.Color color)
        {
            this.visible = true;
            this.Curve   = curve;
            this.Id      = latestId++;
            this.Name    = name;
            this.Control = control;

            ColorBrush = new SolidColorBrush(color);
            ColorBrush.Freeze();

            Pen              = new Pen(ColorBrush, 1);
            Pen.EndLineCap   = PenLineCap.Round;
            Pen.StartLineCap = PenLineCap.Round;
            Pen.Freeze();

            DashedPen = new Pen(ColorBrush, 0.5);
            DashedPen.Freeze();
        }
Beispiel #27
0
        public ScaleKeysCommand(CurveEditorControl2 control, Point min, Point max, ScaleBoxHandle handle)
            : base(control)
        {
            // Store the parameters.
            _min = min;
            _max = max;
            _newMin = min;
            _newMax = max;
            _handle = handle;

            // Store the current selection, if any.
            _affectedKeys = new long[control.Selection.Count];
            _normalizedPos = new Point[control.Selection.Count];
            var i = 0;
            foreach (var key in control.Selection) {
                _affectedKeys[i] = key.Id;

                var pos = key.GetPosition();
                _normalizedPos[i].X = (pos.X - min.X) / (max.X - min.X);
                _normalizedPos[i].Y = (pos.Y - min.Y) / (max.Y - min.Y);

                i++;
            }
        }
Beispiel #28
0
 public CurveEditorCommand(CurveEditorControl2 control) {
     Control = control;
 }
Beispiel #29
0
 /// <summary>
 /// Creates a new command to select the given keys. You can pass null to deselect all.
 /// </summary>
 public DeleteKeysCommand(CurveEditorControl2 control)
     : base(control)
 {
 }
Beispiel #30
0
 /// <summary>
 /// Creates a new command to select the given keys. You can pass null to deselect all.
 /// </summary>
 public DeleteKeysCommand(CurveEditorControl2 control)
     : base(control)
 {
 }
Beispiel #31
0
 public CurveTreeViewModel(CurveEditorControl2 control)
 {
     Control = control;
     Root    = new CurveTreeNode(String.Empty, null);
 }
            public ZoomExtentsCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, bool selectionOnly)
            {
                _control = control;
                _viewModel = viewModel;
                _selectionOnly = selectionOnly;

                control.SelectionChanged += control_SelectionChanged;
            }
 public ZoomCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, float xFactor, float yFactor)
 {
     _control = control;
     _viewModel = viewModel;
     _xFactor = xFactor;
     _yFactor = yFactor;
     CanExecuteChanged = delegate { };
 }
 public SetBothTangentsCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, KeyTangentMode tangentMode)
 {
     _control = control;
     _viewModel = viewModel;
     _tangentMode = tangentMode;
     CanExecuteChanged = delegate { };
 }
Beispiel #35
0
 public CurveTreeViewModel(CurveEditorControl2 control)
 {
     this.Control = control;
     this.Root = new CurveTreeNode(String.Empty, null);
 }
Beispiel #36
0
 public CurveEditorCommand(CurveEditorControl2 control)
 {
     Control = control;
 }
Beispiel #37
0
 public SetBothTangentsCommand(CurveEditorControl2 control, CurveEditorControlsViewModel viewModel, KeyTangentMode tangentMode)
 {
     this.control     = control;
     this.viewModel   = viewModel;
     this.tangentMode = tangentMode;
 }