Example #1
0
        /// <summary>
        /// Function for redirecting commands to the editors. Acquired from
        /// https://joshvarty.wordpress.com/2014/08/01/ripping-the-visual-studio-editor-apart-with-projection-buffers/
        /// </summary>
        protected override bool PreProcessMessage(ref Message m)
        {
            if (isInEditorViewMode)
            {
                var pMsg = new MSG[1];
                pMsg[0].hwnd    = m.HWnd;
                pMsg[0].message = (uint)m.Msg;
                pMsg[0].wParam  = m.WParam;
                pMsg[0].lParam  = m.LParam;

                var vsWindowPane = (IVsWindowPane)(EditorViewControl.Instance.Editor.GetTextView());
                return(vsWindowPane.TranslateAccelerator(pMsg) == 0);
            }
            else
            {
                BlockControl block = BlockManager.Instance.ActiveBlock;
                if (block != null)
                {
                    // copy the Message into a MSG[] array, so we can pass
                    // it along to the active core editor's IVsWindowPane.TranslateAccelerator
                    var pMsg = new MSG[1];
                    pMsg[0].hwnd    = m.HWnd;
                    pMsg[0].message = (uint)m.Msg;
                    pMsg[0].wParam  = m.WParam;
                    pMsg[0].lParam  = m.LParam;

                    var vsWindowPane = (IVsWindowPane)(block.Editor.GetTextView());
                    return(vsWindowPane.TranslateAccelerator(pMsg) == 0);
                }
                return(base.PreProcessMessage(ref m));
            }
        }
 /// <summary>
 /// Switch to the full-window editor view for the given editor block.
 /// </summary>
 public void EnterEditorView(BlockControl block)
 {
     SaveScrollOffsets();
     EditorViewControl.Instance.SetEditor(block);
     Content = EditorViewControl.Instance;
     SplayCodeToolWindow.SetEditorViewMode(true);
 }
Example #3
0
        /// <summary>
        /// Function for redirecting commands to the editors. Acquired from
        /// https://joshvarty.wordpress.com/2014/08/01/ripping-the-visual-studio-editor-apart-with-projection-buffers/
        /// </summary>
        int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[]
                                          prgCmds, IntPtr pCmdText)
        {
            var hr =
                (int)Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED;

            if (isInEditorViewMode)
            {
                var cmdTarget = (IOleCommandTarget)(EditorViewControl.Instance.Editor.GetTextView());
                hr = cmdTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
                return(hr);
            }
            else
            {
                BlockControl block = BlockManager.Instance.ActiveBlock;
                if (block != null)
                {
                    var cmdTarget = (IOleCommandTarget)(block.Editor.GetTextView());
                    hr = cmdTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
                }
                return(hr);
            }
        }
Example #4
0
        /// <summary>
        /// Function for redirecting commands to the editors. Acquired from
        /// https://joshvarty.wordpress.com/2014/08/01/ripping-the-visual-studio-editor-apart-with-projection-buffers/
        /// </summary>
        int IOleCommandTarget.Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt,
                                   IntPtr pvaIn, IntPtr pvaOut)
        {
            var hr =
                (int)Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED;

            if (isInEditorViewMode)
            {
                var cmdTarget = (IOleCommandTarget)(EditorViewControl.Instance.Editor.GetTextView());
                hr = cmdTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
                return(hr);
            }
            else
            {
                BlockControl block = BlockManager.Instance.ActiveBlock;
                if (block != null)
                {
                    var cmdTarget = (IOleCommandTarget)(block.Editor.GetTextView());
                    hr = cmdTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
                }
                return(hr);
            }
        }
 /// <summary>
 /// Center view on the given block in the virtual space.
 /// </summary>
 public void CenterViewOn(BlockControl block)
 {
     SetVirtualSpaceZoomLevel(1.0, true, true);
     ScrollView.ScrollToHorizontalOffset(block.Margin.Left - (ScrollView.ViewportWidth / 10));
     ScrollView.ScrollToVerticalOffset(block.Margin.Top - (ScrollView.ViewportHeight / 10));
 }
 /// <summary>
 /// Remove a block from the virtual space.
 /// </summary>
 public void DeleteBlock(BlockControl block)
 {
     baseGrid.Children.Remove(block);
 }
 /// <summary>
 /// Add a block to the virtual space.
 /// </summary>
 public void InsertBlock(BlockControl block)
 {
     baseGrid.Children.Add(block);
 }