コード例 #1
0
        public BlameControl()
        {
            InitializeComponent();
            InitializeComplete();

            BlameAuthor.IsReadOnly = true;
            BlameAuthor.EnableScrollBars(false);
            UpdateShowLineNumbers();
            BlameAuthor.HScrollPositionChanged += BlameAuthor_HScrollPositionChanged;
            BlameAuthor.VScrollPositionChanged += BlameAuthor_VScrollPositionChanged;
            BlameAuthor.MouseMove           += BlameAuthor_MouseMove;
            BlameAuthor.MouseLeave          += BlameAuthor_MouseLeave;
            BlameAuthor.SelectedLineChanged += SelectedLineChanged;
            BlameAuthor.RequestDiffView     += ActiveTextAreaControlDoubleClick;
            BlameAuthor.EscapePressed       += () => EscapePressed?.Invoke();

            BlameFile.IsReadOnly              = true;
            BlameFile.VScrollPositionChanged += BlameFile_VScrollPositionChanged;
            BlameFile.SelectedLineChanged    += SelectedLineChanged;
            BlameFile.RequestDiffView        += ActiveTextAreaControlDoubleClick;
            BlameFile.MouseMove     += BlameFile_MouseMove;
            BlameFile.EscapePressed += () => EscapePressed?.Invoke();

            CommitInfo.CommandClicked += commitInfo_CommandClicked;
        }
コード例 #2
0
        public CommitDiff()
        {
            InitializeComponent();
            InitializeComplete();

            DiffText.EscapePressed             += () => EscapePressed?.Invoke();
            DiffText.ExtraDiffArgumentsChanged += DiffText_ExtraDiffArgumentsChanged;
            DiffFiles.Focus();
            DiffFiles.SetDiffs();

            splitContainer1.SplitterDistance = DpiUtil.Scale(200);
            splitContainer2.SplitterDistance = DpiUtil.Scale(260);
        }
コード例 #3
0
ファイル: GameKeyboard.cs プロジェクト: DerNooM/HostileSpace
        private void RenderWindow_TextEntered(object sender, TextEventArgs e)
        {
            //Console.WriteLine((int)e.Unicode[0]);

            if (e.Unicode[0] >= 48 && e.Unicode[0] <= 57)
            {
                KeyPressed?.Invoke(this, new KeyPressedArgs()
                {
                    Char = e.Unicode[0]
                });
            }
            else if (e.Unicode[0] >= 65 && e.Unicode[0] <= 90)
            {
                KeyPressed?.Invoke(this, new KeyPressedArgs()
                {
                    Char = e.Unicode[0]
                });
            }
            else if (e.Unicode[0] >= 97 && e.Unicode[0] <= 122)
            {
                KeyPressed?.Invoke(this, new KeyPressedArgs()
                {
                    Char = e.Unicode[0]
                });
            }

            if (e.Unicode[0] == 8)
            {
                BackspacePressed?.Invoke(this, null);
            }

            if (e.Unicode[0] == 9)
            {
                TabulatorPressed?.Invoke(this, null);
            }

            if (e.Unicode[0] == 13)
            {
                EnterPressed?.Invoke(this, null);
            }

            if (e.Unicode[0] == 27)
            {
                EscapePressed?.Invoke(this, null);
            }

            if (e.Unicode[0] == 32)
            {
                SpacePressed?.Invoke(this, null);
            }
        }
コード例 #4
0
        public FileViewerInternal()
        {
            InitializeComponent();
            InitializeComplete();

            Disposed += (sender, e) =>
            {
                //// _diffHighlightService not disposable
                //// _lineNumbersControl not disposable
                //// _currentViewPositionCache not disposable
                _findAndReplaceForm.Dispose();
            };

            _currentViewPositionCache = new CurrentViewPositionCache(this);
            TextEditor.ActiveTextAreaControl.TextArea.SelectionManager.SelectionChanged += SelectionManagerSelectionChanged;

            TextEditor.ActiveTextAreaControl.TextArea.PreviewKeyDown += (s, e) =>
            {
                if (e.KeyCode == Keys.Escape && !TextEditor.ActiveTextAreaControl.SelectionManager.HasSomethingSelected)
                {
                    EscapePressed?.Invoke();
                }
            };

            TextEditor.TextChanged += (s, e) => TextChanged?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.HScrollBar.ValueChanged += (s, e) => OnHScrollPositionChanged(EventArgs.Empty);
            TextEditor.ActiveTextAreaControl.VScrollBar.ValueChanged += (s, e) => OnVScrollPositionChanged(EventArgs.Empty);
            TextEditor.ActiveTextAreaControl.TextArea.KeyUp          += (s, e) => KeyUp?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.DoubleClick    += (s, e) => DoubleClick?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseMove      += (s, e) => MouseMove?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseEnter     += (s, e) => MouseEnter?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseLeave     += (s, e) => MouseLeave?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseDown      += (s, e) =>
            {
                SelectedLineChanged?.Invoke(
                    this,
                    new SelectedLineEventArgs(
                        TextEditor.ActiveTextAreaControl.TextArea.TextView.GetLogicalLine(e.Y)));
            };
            TextEditor.ActiveTextAreaControl.TextArea.MouseWheel += TextArea_MouseWheel;

            HighlightingManager.Manager.DefaultHighlighting.SetColorFor("LineNumbers",
                                                                        new HighlightColor(SystemColors.ControlText, SystemColors.Control, false, false));
            TextEditor.ActiveTextAreaControl.TextEditorProperties.EnableFolding = false;

            _lineNumbersControl = new DiffViewerLineNumberControl(TextEditor.ActiveTextAreaControl.TextArea);

            VRulerPosition = AppSettings.DiffVerticalRulerPosition;
        }
コード例 #5
0
        public CommitDiff()
        {
            InitializeComponent();
            InitializeComplete();

            DiffText.EscapePressed             += () => EscapePressed?.Invoke();
            DiffText.ExtraDiffArgumentsChanged += DiffText_ExtraDiffArgumentsChanged;
            DiffText.TopScrollReached          += FileViewer_TopScrollReached;
            DiffText.BottomScrollReached       += FileViewer_BottomScrollReached;
            DiffFiles.Focus();
            DiffFiles.ClearDiffs();

            splitContainer1.SplitterDistance = DpiUtil.Scale(200);
            splitContainer2.SplitterDistance = DpiUtil.Scale(260);
        }
コード例 #6
0
        private void Update()
        {
            if (Input.GetButton("Cancel"))
            {
                EscapePressed?.Invoke();
            }

            if (!_isPointerDown)
            {
                Drag = Vector2.zero;
                return;
            }

            var mousePos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);

            _isDragging = _isDragging || (mousePos - _pointerDownPosition).sqrMagnitude >= _minDragDelta;
            if (_isDragging)
            {
                Drag = _pointerDownPosition - mousePos;
                _pointerDownPosition = mousePos;
            }
        }
コード例 #7
0
        public FileViewerInternal()
        {
            InitializeComponent();
            InitializeComplete();

            _currentViewPositionCache = new CurrentViewPositionCache(this);

            TextEditor.ActiveTextAreaControl.TextArea.PreviewKeyDown += (s, e) =>
            {
                if (e.KeyCode == Keys.Escape && !TextEditor.ActiveTextAreaControl.SelectionManager.HasSomethingSelected)
                {
                    EscapePressed?.Invoke();
                }
            };

            TextEditor.TextChanged += (s, e) => TextChanged?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.HScrollBar.ValueChanged += (s, e) => OnHScrollPositionChanged(EventArgs.Empty);
            TextEditor.ActiveTextAreaControl.VScrollBar.ValueChanged += (s, e) => OnVScrollPositionChanged(EventArgs.Empty);
            TextEditor.ActiveTextAreaControl.TextArea.KeyUp          += (s, e) => KeyUp?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.DoubleClick    += (s, e) => DoubleClick?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseMove      += (s, e) => MouseMove?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseEnter     += (s, e) => MouseEnter?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseLeave     += (s, e) => MouseLeave?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseDown      += (s, e) =>
            {
                SelectedLineChanged?.Invoke(
                    this,
                    new SelectedLineEventArgs(
                        TextEditor.ActiveTextAreaControl.TextArea.TextView.GetLogicalLine(e.Y)));
            };

            HighlightingManager.Manager.DefaultHighlighting.SetColorFor("LineNumbers", new HighlightColor(Color.FromArgb(80, 0, 0, 0), Color.White, false, false));
            TextEditor.ActiveTextAreaControl.TextEditorProperties.EnableFolding = false;

            _lineNumbersControl = new DiffViewerLineNumberControl(TextEditor.ActiveTextAreaControl.TextArea);

            VRulerPosition = AppSettings.DiffVerticalRulerPosition;
        }
コード例 #8
0
        private void Update()
        {
            if (InputProxy.GetKeyUp(KeyCode.Escape))
            {
                EscapePressed?.Invoke();
            }

            foreach (var pair in ModificationKeys)
            {
                if (InputProxy.GetKeyDown(pair.Key))
                {
                    keyboardInput.KeyDown(pair.Value);
                }

                if (InputProxy.GetKeyUp(pair.Key))
                {
                    keyboardInput.KeyUp(pair.Value);
                }
            }

            foreach (var pair in NumpadKeys)
            {
                if (InputProxy.GetKeyDown(pair.Key))
                {
                    keyboardInput.PressKey(pair.Value);
                }
            }

            AllKeyCodes.ForEach(code =>
            {
                if (InputProxy.GetKeyDown(code))
                {
                    var key = KeysConverter.Convert(code);
                    keyboardInput.PressKey(key);
                }
            });
        }
コード例 #9
0
    private void Update()
    {
        ManualHandleOfKeyCode(KeyCode.LeftShift, "Shift");
        ManualHandleOfKeyCode(KeyCode.RightShift, "Shift");
        ManualHandleOfKeyCode(KeyCode.LeftAlt, "Alt");
        ManualHandleOfKeyCode(KeyCode.RightAlt, "Alt");
        ManualHandleOfKeyCode(KeyCode.LeftControl, "Control");
        ManualHandleOfKeyCode(KeyCode.RightControl, "Control");

        if (Input.GetKeyUp(KeyCode.Escape))
        {
            EscapePressed?.Invoke();
        }

        AllKeyCodes.ForEach(code =>
        {
            if (!Input.GetKeyDown(code))
            {
                return;
            }
            var key = KeysConverter.Convert(code);
            keyboardInput.PressKey(key);
        });
    }
コード例 #10
0
 // Following good practices, this method invokes the EscapePressed
 // event
 private void OnEscapePressed()
 {
     EscapePressed?.Invoke();
 }
コード例 #11
0
 /// <summary>
 /// Invokes the EscapePressed event.
 /// </summary>
 protected virtual void OnEscapePressed()
 => EscapePressed?.Invoke();
コード例 #12
0
 protected void OnEscapePressed(KeyPressedEventArgs e)
 {
     EscapePressed?.Invoke(this, e);
 }