Ejemplo n.º 1
0
        public static void MoveOutRight(IEditor editor)
        {
            var bounds = editor.Figure.Bounds;

            editor.Parent.RequestSelect(SelectKind.True, true);
            editor.Site.Caret.Position = CaretUtil.GetExpectedCaretPosition(
                new Point(bounds.Right - 1, bounds.Top), editor.Site.GridService
                );
        }
Ejemplo n.º 2
0
        public static void Remove(IEditor editor)
        {
            var parent = editor.Parent;
            var loc    = CaretUtil.GetExpectedCaretPosition(editor.Figure.Location, editor.Site.GridService);
            var caret  = editor.Site.Caret;

            editor.RequestRemove();
            caret.Position = loc;
            parent.RequestSelect(SelectKind.True, true);
        }
Ejemplo n.º 3
0
        public static void MoveCaretLeft(IEditor editor)
        {
            var caret              = editor.Site.EditorCanvas.Caret;
            var expectedMemoPos    = CaretUtil.GetExpectedMemoTextPosition(caret.Position);
            var newExpectedMemoPos = new Point(expectedMemoPos.X - MemopadConsts.CaretMoveDelta, expectedMemoPos.Y);

            caret.Position = CaretUtil.GetExpectedCaretPosition(
                newExpectedMemoPos, editor.Site.GridService
                );
            FocusMemoText(editor, caret.Position);
        }
Ejemplo n.º 4
0
        protected virtual void HandleMouseDown(object sender, MouseEventArgs e)
        {
            /// 他のEditorがFocusされていたらCommitしておく
            var prevFocused = Handle.Host.Site.FocusManager.FocusedEditor;

            if (prevFocused != null && prevFocused != Handle.Host)
            {
                prevFocused.RequestFocusCommit(true);
            }

            _toggle = KeyUtil.IsControlPressed();
            if (!_toggle)
            {
                Handle.Host.RequestSelect(SelectKind.True, true);
            }

            if (_Caret != null)
            {
                var expectedTextPos = CaretUtil.GetExpectedMemoTextPosition(new Point(e.X, e.Y - _Caret.Height / 2));
                _Caret.Position = CaretUtil.GetExpectedCaretPosition(expectedTextPos, Handle.Host.Site.GridService);
            }
        }