예제 #1
0
        // --- mouse ---
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            ClearDragTarget();
            if (e.Button != MouseButtons.Left || e.Clicks >= 2)
            {
                return;
            }

            var tabPage = GetTabPage(e.Location);

            if (tabPage != null)
            {
                if (e.Button == MouseButtons.Left && !KeyUtil.IsShiftPressed() && !KeyUtil.IsControlPressed())
                {
                    var r = GetCloseButtonBounds(tabPage);
                    if (r.Contains(e.Location))
                    {
                        OnCloseButtonPressed(tabPage);
                        _closeButtonState = CloseButtonState.None;
                        Invalidate(r);
                        return;
                    }
                }
            }

            SetupDragTarget(e.X, e.Y);
        }
        protected override void OnFigureMouseDown(MouseEventArgs e)
        {
            _startRowIndex = -1;
            _startColIndex = -1;
            _endRowIndex   = -1;
            _endColIndex   = -1;

            _isScenarioHandled = false;

            if (KeyUtil.IsShiftPressed())
            {
                var parent          = Host.Parent;
                var man             = Host.Site.SelectionManager;
                var selectedEditors = man.SelectedEditors;
                if (selectedEditors.Any() && selectedEditors.First().Parent == parent)
                {
                    var tableData   = GetParentTableData();
                    var firstEditor = selectedEditors.First();
                    _startRowIndex = tableData.GetRowIndex(firstEditor.Figure as TableCellFigure);
                    _startColIndex = tableData.GetColumnIndex(firstEditor.Figure as TableCellFigure);

                    _endRowIndex = tableData.GetRowIndex(Host.Figure as TableCellFigure);
                    _endColIndex = tableData.GetColumnIndex(Host.Figure as TableCellFigure);
                    SelectRange(_startRowIndex, _startColIndex, _endRowIndex, _endColIndex);
                }
            }
            else if (
                e.Button == MouseButtons.Left &&
                !KeyUtil.IsAltPressed() &&
                !KeyUtil.IsControlPressed() &&
                !KeyUtil.IsShiftPressed()
                )
            {
                var run = GetRun(e.Location);
                if (run != null && run.HasLink)
                {
                    LinkUtil.GoLink(run.Link);
                    _isScenarioHandled = true;
                }
                else
                {
                    _selectScenario.HandleMouseDown(this, e);
                }
            }
            else
            {
                _selectScenario.HandleMouseDown(this, e);
            }

            base.OnFigureMouseDown(e);
        }
예제 #3
0
        protected override void OnFigureMouseClick(MouseEventArgs e)
        {
            var handled = false;

            if (
                e.Button == MouseButtons.Left &&
                !KeyUtil.IsAltPressed() &&
                !KeyUtil.IsControlPressed() &&
                !KeyUtil.IsShiftPressed()
                )
            {
                var run = GetRun(e.Location);
                if (run != null && run.HasLink)
                {
                    LinkUtil.GoLink(run.Link);
                    handled = true;
                }
            }

            if (!handled)
            {
                base.OnFigureMouseClick(e);
            }
        }
예제 #4
0
        protected override void OnFigureMouseDown(MouseEventArgs e)
        {
            var handled = false;

            if (
                (e.Button == MouseButtons.Left || e.Button == MouseButtons.Middle) &&
                !KeyUtil.IsAltPressed() &&
                !KeyUtil.IsControlPressed() &&
                !KeyUtil.IsShiftPressed()
                )
            {
                var run = GetRun(e.Location);
                if (run != null && run.HasLink)
                {
                    LinkUtil.GoLink(run.Link);
                    handled = true;
                }
            }

            /// checkbox
            if (e.Button == MouseButtons.Left)
            {
                var node = _Figure as INode;
                if (node != null)
                {
                    var bulcmd = node.GetProcessCheckBoxBulletCommand(e.Location);
                    if (bulcmd != null)
                    {
                        /// bulcmdはFigureのStyledTextを変更するだけ
                        /// ModelのStyledTextを変えないといけない
                        bulcmd.Execute();

                        var model    = Host.Model as MemoText;
                        var oldStext = model.StyledText;
                        var newStext = node.StyledText.CloneDeeply() as StyledText.Core.StyledText;
                        var cmd      = new DelegatingCommand(
                            () => {
                            model.StyledText = newStext;
                        },
                            () => {
                            model.StyledText = oldStext;
                        }
                            );
                        Host.Site.CommandExecutor.Execute(cmd);
                        handled = true;
                    }
                }
            }


            if (!handled)
            {
                _isSelectedOnMouseDown = Host.IsSelected;
                _toggle = KeyUtil.IsControlPressed();

                /// EditorがFocusされていたらCommitしておく
                var focused = Host.Site.FocusManager.FocusedEditor;
                if (focused != null)
                {
                    focused.RequestFocusCommit(true);
                }

                Host.RequestSelect(SelectKind.True, !_toggle && !Host.IsSelected);
                if (e.Button == MouseButtons.Left && !KeyUtil.IsControlPressed())
                {
                    Host.RequestFocus(FocusKind.Begin, e.Location);
                    Host.Site.EditorCanvas.EventDispatcher.SetDnDTarget(Host.Focus.Figure);
                }
                base.OnFigureMouseDown(e);
            }
        }