Esempio n. 1
0
        protected virtual void OnButtonClick(DiffEditorButtonEventArgs e)
        {
            var ev = ButtonClick;

            if (ev != null)
            {
                ev(this, e);
            }
        }
Esempio n. 2
0
        private void _editor_ButtonClick(object sender, DiffEditorButtonEventArgs e)
        {
            var cancelArgs = new CancelEventArgs();

            switch (e.Type)
            {
                case DiffEditorButtonType.CopyLeft:
                case DiffEditorButtonType.DeleteRight:
                    OnLeftUpdating(cancelArgs);
                    break;

                case DiffEditorButtonType.DeleteLeft:
                case DiffEditorButtonType.CopyRight:
                    OnRightUpdating(cancelArgs);
                    break;
            }

            if (cancelArgs.Cancel)
                return;

            Debug.Assert(!_readOnly);

            switch (e.Type)
            {
                case DiffEditorButtonType.CopyLeft:
                    PerformCopy(
                        _leftEditor,
                        _rightEditor,
                        e.Marker.Line,
                        e.Marker.Length,
                        e.Marker.LeftLength
                    );
                    RemoveMarker(e.Marker, e.Marker.Length - e.Marker.LeftLength);
                    break;

                case DiffEditorButtonType.DeleteLeft:
                case DiffEditorButtonType.DeleteRight:
                    RemoveFromDocument(_leftEditor, e.Marker.Line, e.Marker.Length);
                    RemoveFromDocument(_rightEditor, e.Marker.Line, e.Marker.Length);
                    RemoveMarker(e.Marker, e.Marker.Length);
                    break;

                case DiffEditorButtonType.CopyRight:
                    PerformCopy(
                        _rightEditor,
                        _leftEditor,
                        e.Marker.Line,
                        e.Marker.Length,
                        e.Marker.RightLength
                    );
                    RemoveMarker(e.Marker, e.Marker.Length - e.Marker.RightLength);
                    break;
            }

            switch (e.Type)
            {
                case DiffEditorButtonType.CopyLeft:
                case DiffEditorButtonType.DeleteRight:
                    OnRightUpdated(EventArgs.Empty);
                    break;

                case DiffEditorButtonType.DeleteLeft:
                case DiffEditorButtonType.CopyRight:
                    OnLeftUpdated(EventArgs.Empty);
                    break;
            }
        }
Esempio n. 3
0
 protected virtual void OnButtonClick(DiffEditorButtonEventArgs e)
 {
     var ev = ButtonClick;
     if (ev != null)
         ev(this, e);
 }
Esempio n. 4
0
        private void _editor_ButtonClick(object sender, DiffEditorButtonEventArgs e)
        {
            var cancelArgs = new CancelEventArgs();

            switch (e.Type)
            {
            case DiffEditorButtonType.CopyLeft:
            case DiffEditorButtonType.DeleteRight:
                OnLeftUpdating(cancelArgs);
                break;

            case DiffEditorButtonType.DeleteLeft:
            case DiffEditorButtonType.CopyRight:
                OnRightUpdating(cancelArgs);
                break;
            }

            if (cancelArgs.Cancel)
            {
                return;
            }

            Debug.Assert(!_readOnly);

            switch (e.Type)
            {
            case DiffEditorButtonType.CopyLeft:
                PerformCopy(
                    _leftEditor,
                    _rightEditor,
                    e.Marker.Line,
                    e.Marker.Length,
                    e.Marker.LeftLength
                    );
                RemoveMarker(e.Marker, e.Marker.Length - e.Marker.LeftLength);
                break;

            case DiffEditorButtonType.DeleteLeft:
            case DiffEditorButtonType.DeleteRight:
                RemoveFromDocument(_leftEditor, e.Marker.Line, e.Marker.Length);
                RemoveFromDocument(_rightEditor, e.Marker.Line, e.Marker.Length);
                RemoveMarker(e.Marker, e.Marker.Length);
                break;

            case DiffEditorButtonType.CopyRight:
                PerformCopy(
                    _rightEditor,
                    _leftEditor,
                    e.Marker.Line,
                    e.Marker.Length,
                    e.Marker.RightLength
                    );
                RemoveMarker(e.Marker, e.Marker.Length - e.Marker.RightLength);
                break;
            }

            switch (e.Type)
            {
            case DiffEditorButtonType.CopyLeft:
            case DiffEditorButtonType.DeleteRight:
                OnRightUpdated(EventArgs.Empty);
                break;

            case DiffEditorButtonType.DeleteLeft:
            case DiffEditorButtonType.CopyRight:
                OnLeftUpdated(EventArgs.Empty);
                break;
            }
        }