Пример #1
0
        public void MouseClick(Point P)
        {
            EventManager.HoldEvents();

            undoManager.ClosePackage();

            Clock.RemoveAlarm(mouseDragTimer);
            mouseDragTimer = Clock.NULL_ALARM;
            dragDelayOK    = true;

            DocumentLocation dl = getDocLocFromScreenXY(getScreenXYFromPixel(P));

            if (selectAnchor != null)
            {
                CaretDocLoc  = dl;
                PreferredX   = CaretXY.X;
                selectAnchor = null;
            }
            else if (dragging && !Selection.IsEmpty)
            {
                dragging      = false;
                parent.Cursor = Cursors.Default;
                string s = doc.GetText(Selection);
                DocumentRangeLength drl = Selection.DRLength;
                if (Selection.Start >= dl)
                {
                    doc.Delete(Selection);
                    Selection = DocumentRange.Empty;
                    doc.Insert(s, dl);
                    CaretDocLoc = dl;
                }
                else if (Selection.End <= dl)
                {
                    doc.Insert(s, dl);
                    doc.Delete(Selection);
                    Selection = DocumentRange.Empty;
                }
                CaretDocLoc = dl;
                Selection   = new DocumentRange(dl, drl, doc);
            }
            else if (textArea.Contains(P))
            {
                CaretDocLoc    = dl;
                PreferredX     = xCoord(dl);
                this.Selection = DocumentRange.Empty;
            }

            setCaretLocation(false);
            parent.Invalidate();

            EventManager.ReleaseEvents(true);

            undoManager.ClosePackage();
        }
Пример #2
0
 internal DocumentRange(DocumentLocation DL, DocumentRangeLength DRL, Document Document)
 {
     start = DL;
     end   = Document.EnsureValid(new DocumentLocation(DL.LineNumber + DRL.Lines, DL.ColumnNumber + DRL.Columns));
 }