Ejemplo n.º 1
0
 void Api.IDropTarget.DragEnter(System.Runtime.InteropServices.ComTypes.IDataObject d, int grfKeyState, POINT pt, ref int effect)
 {
     _data     = default;
     _justText = false;
     if (_canDrop = _data.GetData(d, getFileNodes: true))
     {
         _justText = _data.text != null && _data.linkName == null;
     }
     effect = _GetEffect(effect, grfKeyState);
     CodeInfo.Cancel();
 }
Ejemplo n.º 2
0
    //protected override void Dispose(bool disposing)
    //{
    //	AOutput.QM2.Write($"Dispose disposing={disposing} IsHandleCreated={IsHandleCreated} Visible={Visible}");
    //	base.Dispose(disposing);
    //}

    protected unsafe override void ZOnSciNotify(ref SCNotification n)
    {
        //switch(n.nmhdr.code) {
        //case NOTIF.SCN_PAINTED:
        ////case NOTIF.SCN_UPDATEUI:
        //case NOTIF.SCN_FOCUSIN:
        //case NOTIF.SCN_FOCUSOUT:
        //case NOTIF.SCN_DWELLSTART:
        //case NOTIF.SCN_DWELLEND:
        //case NOTIF.SCN_NEEDSHOWN:
        //	break;
        //case NOTIF.SCN_MODIFIED:
        //	AOutput.Write(n.nmhdr.code, n.modificationType);
        //	break;
        //default:
        //	AOutput.Write(n.nmhdr.code);
        //	break;
        //}

        switch (n.nmhdr.code)
        {
        case NOTIF.SCN_SAVEPOINTLEFT:
            Program.Model.Save.TextLater();
            break;

        case NOTIF.SCN_SAVEPOINTREACHED:
            //never mind: we should cancel the 'save text later'
            break;

        case NOTIF.SCN_MODIFIED:
            //AOutput.Write("SCN_MODIFIED", n.modificationType, n.position, n.FinalPosition, Z.CurrentPos8, n.Text);
            //AOutput.Write(n.modificationType);
            //if(n.modificationType.Has(MOD.SC_PERFORMED_USER | MOD.SC_MOD_BEFOREINSERT)) {
            //	AOutput.Write($"'{n.Text}'");
            //	if(n.length == 2 && n.textUTF8!=null && n.textUTF8[0]=='\r' && n.textUTF8[1] == '\n') {
            //		Call(SCI_BEGINUNDOACTION); Call(SCI_ENDUNDOACTION);
            //	}
            //}
            if (n.modificationType.HasAny(MOD.SC_MOD_INSERTTEXT | MOD.SC_MOD_DELETETEXT))
            {
                _modified = true;
                _TempRangeOnModifiedOrPosChanged(n.modificationType, n.position, n.length);
                CodeInfo.SciModified(this, n);
                Panels.Find.ZUpdateQuickResults(true);
                //} else if(n.modificationType.Has(MOD.SC_MOD_INSERTCHECK)) {
                //	//AOutput.Write(n.Text);
                //	//if(n.length==1 && n.textUTF8[0] == ')') {
                //	//	Call(Sci.SCI_SETOVERTYPE, _testOvertype = true);

                //	//}
            }
            break;

        case NOTIF.SCN_CHARADDED:
            //AOutput.Write($"SCN_CHARADDED  {n.ch}  '{(char)n.ch}'");
            if (n.ch == '\n' /*|| n.ch == ';'*/)              //split scintilla Undo
            {
                Z.AddUndoPoint();
            }
            if (n.ch != '\r' && n.ch <= 0xffff)              //on Enter we receive notifications for '\r' and '\n'
            {
                CodeInfo.SciCharAdded(this, (char)n.ch);
            }
            break;

        case NOTIF.SCN_UPDATEUI:
            //AOutput.Write((uint)n.updated, _modified);
            if (0 != (n.updated & 1))
            {
                if (_modified)
                {
                    _modified = false;
                }
                else
                {
                    n.updated &= ~1;                                                   //ignore notifications when changed styling or markers
                }
            }
            if (0 == (n.updated & 15))
            {
                break;
            }
            if (0 != (n.updated & 3))              //text (1), selection/click (2)
            {
                _TempRangeOnModifiedOrPosChanged(0, 0, 0);
                Panels.Editor._UpdateUI_EditEnabled();
            }
            CodeInfo.SciUpdateUI(this, n.updated);
            break;

        case NOTIF.SCN_DWELLSTART:
            CodeInfo.SciMouseDwellStarted(this, n.position);
            break;

        case NOTIF.SCN_DWELLEND:
            CodeInfo.SciMouseDwellEnded(this);
            break;

        case NOTIF.SCN_MARGINCLICK:
            if (_fn.IsCodeFile)
            {
                CodeInfo.Cancel();
                if (n.margin == c_marginFold)
                {
                    _FoldOnMarginClick(null, n.position);
                }

                //SHOULDDO: when clicked selbar to select a fold header line, should select all hidden lines. Like in VS.
            }
            break;
        }

        base.ZOnSciNotify(ref n);
    }
Ejemplo n.º 3
0
    protected override void ZOnSciNotify(ref SCNotification n)
    {
        //if (test_) {
        //	switch (n.nmhdr.code) {
        //	case NOTIF.SCN_UPDATEUI:
        //	case NOTIF.SCN_NEEDSHOWN:
        //	case NOTIF.SCN_PAINTED:
        //	case NOTIF.SCN_FOCUSIN:
        //	case NOTIF.SCN_FOCUSOUT:
        //	case NOTIF.SCN_DWELLSTART:
        //	case NOTIF.SCN_DWELLEND:
        //		break;
        //	case NOTIF.SCN_MODIFIED:
        //		print.it(n.nmhdr.code, n.modificationType);
        //		break;
        //	default:
        //		print.it(n.nmhdr.code);
        //		break;
        //	}
        //}


        switch (n.nmhdr.code)
        {
        case NOTIF.SCN_SAVEPOINTLEFT:
            App.Model.Save.TextLater();
            break;

        case NOTIF.SCN_SAVEPOINTREACHED:
            //never mind: we should cancel the 'save text later'
            break;

        case NOTIF.SCN_MODIFIED:
            //print.it("SCN_MODIFIED", n.modificationType, n.position, n.FinalPosition, zCurrentPos8, n.Text);
            //print.it(n.modificationType);
            //if(n.modificationType.Has(MOD.SC_PERFORMED_USER | MOD.SC_MOD_BEFOREINSERT)) {
            //	print.it($"'{n.Text}'");
            //	if(n.length == 2 && n.textUTF8!=null && n.textUTF8[0]=='\r' && n.textUTF8[1] == '\n') {
            //		Call(SCI_BEGINUNDOACTION); Call(SCI_ENDUNDOACTION);
            //	}
            //}
            if (n.modificationType.HasAny(MOD.SC_MOD_INSERTTEXT | MOD.SC_MOD_DELETETEXT))
            {
                _modified = true;
                _TempRangeOnModifiedOrPosChanged(n.modificationType, n.position, n.length);
                App.Model.EditGoBack.OnTextModified(this, n.modificationType.Has(MOD.SC_MOD_DELETETEXT), n.position, n.length);
                CodeInfo.SciModified(this, n);
                Panels.Find.ZUpdateQuickResults(true);
                //} else if(n.modificationType.Has(MOD.SC_MOD_INSERTCHECK)) {
                //	//print.it(n.Text);
                //	//if(n.length==1 && n.textUTF8[0] == ')') {
                //	//	Call(Sci.SCI_SETOVERTYPE, _testOvertype = true);

                //	//}
                if (n.linesAdded != 0)
                {
                    SetLineNumberMarginWidth_(onModified: true);
                }
            }
            break;

        case NOTIF.SCN_CHARADDED:
            //print.it($"SCN_CHARADDED  {n.ch}  '{(char)n.ch}'");
            if (n.ch == '\n' /*|| n.ch == ';'*/)               //split scintilla Undo
            {
                zAddUndoPoint();
            }
            if (n.ch != '\r' && n.ch <= 0xffff)               //on Enter we receive notifications for '\r' and '\n'
            {
                CodeInfo.SciCharAdded(this, (char)n.ch);
            }
            break;

        case NOTIF.SCN_UPDATEUI:
            //print.it((uint)n.updated, _modified);
            if (0 != (n.updated & 1))
            {
                if (_modified)
                {
                    _modified = false;
                }
                else
                {
                    n.updated &= ~1;                                                    //ignore notifications when changed styling or markers
                }
            }
            if (0 == (n.updated & 15))
            {
                break;
            }
            if (0 != (n.updated & 3))               //text (1), selection/click (2)
            {
                _TempRangeOnModifiedOrPosChanged(0, 0, 0);
                if (0 != (n.updated & 2))
                {
                    App.Model.EditGoBack.OnPosChanged(this);
                }
                Panels.Editor._UpdateUI_EditEnabled();
            }
            CodeInfo.SciUpdateUI(this, n.updated);
            break;

        case NOTIF.SCN_DWELLSTART:
            CodeInfo.SciMouseDwellStarted(this, n.position);
            break;

        case NOTIF.SCN_DWELLEND:
            CodeInfo.SciMouseDwellEnded(this);
            break;

        case NOTIF.SCN_MARGINCLICK:
            if (_fn.IsCodeFile)
            {
                CodeInfo.Cancel();
                if (n.margin == c_marginFold)
                {
                    _FoldOnMarginClick(null, n.position);
                }
            }
            break;

        case NOTIF.SCN_STYLENEEDED:
            //print.it("SCN_STYLENEEDED");
            if (_fn.IsCodeFile)
            {
                HideImages_(Call(SCI_GETENDSTYLED), n.position);
                Call(SCI_STARTSTYLING, n.position);                 //need this even if would not hide images
            }
            else
            {
                zSetStyled();
            }
            break;
            //case NOTIF.SCN_PAINTED:
            //	_Paint(true);
            //	break;
        }

        base.ZOnSciNotify(ref n);
    }