Example #1
0
 public void Edit_GoToDefinition()
 {
     CiGoTo.GoToSymbolFromPos();
 }
Example #2
0
    protected override void WndProc(ref Message m)
    {
        //if(m.Msg== Api.WM_PAINT) {
        //	var p1 = APerf.Create();
        //	base.WndProc(ref m);
        //	p1.NW('P');
        //	return;
        //}

        //var w = (AWnd)m.HWnd;
        //AOutput.Write(m);
        switch (m.Msg)
        {
        case Api.WM_SETFOCUS:
            if (!_noModelEnsureCurrentSelected)
            {
                Program.Model.EnsureCurrentSelected();
            }
            break;

        case Api.WM_CHAR: {
            int c = (int)m.WParam;
            if (c < 32)
            {
                if (!(c == 9 || c == 10 || c == 13))
                {
                    return;
                }
            }
            else
            {
                if (CodeInfo.SciBeforeCharAdded(this, (char)c))
                {
                    return;
                }
            }
        }
        break;

        case Api.WM_KEYDOWN:
            if ((KKey)m.WParam == KKey.Insert)
            {
                return;
            }
            break;

        case Api.WM_RBUTTONDOWN: {
            //workaround for Scintilla bug: when right-clicked a margin, if caret or selection start is at that line, goes to the start of line
            POINT p      = (AMath.LoShort(m.LParam), AMath.HiShort(m.LParam));
            int   margin = Z.MarginFromPoint(p, false);
            if (margin >= 0)
            {
                var selStart = Z.SelectionStart8;
                var(_, start, end) = Z.LineStartEndFromPos(false, Z.PosFromXY(false, p, false));
                if (selStart >= start && selStart <= end)
                {
                    return;
                }
                //do vice versa if the end of non-empty selection is at the start of the right-clicked line, to avoid comment/uncomment wrong lines
                if (margin == c_marginLineNumbers || margin == c_marginMarkers)
                {
                    if (Z.SelectionEnd8 == start)
                    {
                        Z.GoToPos(false, start);                                              //clear selection above start
                    }
                }
            }
        }
        break;

        case Api.WM_CONTEXTMENU: {
            bool kbd    = (int)m.LParam == -1;
            int  margin = kbd ? -1 : Z.MarginFromPoint((AMath.LoShort(m.LParam), AMath.HiShort(m.LParam)), true);
            switch (margin)
            {
            case -1:
                Strips.ddEdit.ZShowAsContextMenu(kbd);
                break;

            case c_marginLineNumbers:
            case c_marginMarkers:
                ZCommentLines(null);
                break;
                //case c_marginFold:
                //	break;
            }
        }
            return;
        }

        base.WndProc(ref m);

        switch (m.Msg)
        {
        //case Api.WM_MOUSEMOVE:
        //	CodeInfo.SciMouseMoved(this, AMath.LoShort(m.LParam), AMath.HiShort(m.LParam));
        //	break;
        case Api.WM_KILLFOCUS:
            CodeInfo.SciKillFocus(this);
            break;

        case Api.WM_LBUTTONUP:
            if (ModifierKeys == Keys.Control)
            {
                CiGoTo.GoToSymbolFromPos(onCtrlClick: true);
            }
            break;
        }
    }
Example #3
0
 public static void Go_to_definition()
 {
     CiGoTo.GoToDefinition();
 }