Exemplo n.º 1
0
        void IconBarMargin_MouseDown(AbstractMargin sender, Point mousepos, MouseButtons mouseButtons)
        {
            if (mouseButtons != MouseButtons.Left)
            {
                return;
            }

            IconBarMargin marginObj = (IconBarMargin)sender;

            Rectangle    viewRect = marginObj.TextArea.TextView.DrawingPosition;
            TextLocation logicPos = marginObj.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);

            if (logicPos.Y >= 0 && logicPos.Y < marginObj.TextArea.Document.TotalNumberOfLines)
            {
                LineSegment l = marginObj.Document.GetLineSegment(logicPos.Y);

                string s = marginObj.Document.GetText(l);

                if (s.Trim().Length == 0)
                {
                    return;
                }

                int             lineNr = logicPos.Y + 1;
                BookmarkManager bm     = this.currentFile.Editor.Document.BookmarkManager;

                Bookmark mark = new BreakMark(marginObj.Document, logicPos);
                bm.AddMark(mark);
                Breakpoint bp = new Breakpoint(this.currentFile, lineNr, mark);
                this.debugEngine.SetBreakpoint(bp);
                this.currentFile.Breakpoints.Add(lineNr, bp);
                marginObj.TextArea.Refresh();
            }
        }
Exemplo n.º 2
0
 public static void IconBarMouseDown(AbstractMargin iconBar, Point mousepos, MouseButtons mouseButtons)
 {
     try
     {
         if (mouseButtons != MouseButtons.Left)
         {
             return;
         }
         Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
         //Point logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
         ICSharpCode.TextEditor.TextLocation logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
         if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
         {
             string s = iconBar.TextArea.MotherTextEditorControl.FileName;
             if (s == null)
             {
                 s = TextAreaHelper.GetFileNameByTextArea(iconBar.TextArea);
             }
             ToggleBreakpointAt(iconBar.TextArea.Document, s, logicPos.Y);
             iconBar.TextArea.Refresh(iconBar);
         }
     }
     catch (System.Exception e)
     {
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Toggles breakpoints when clicked on the icon margin of the editor.
        /// </summary>
        private void IconBarMargin_MouseDown(AbstractMargin sender, Point mousepos, MouseButtons mouseButtons)
        {
            var textArea           = textEditorControl.ActiveTextAreaControl.TextArea;
            int clickedVisibleLine = (mousepos.Y + textArea.VirtualTop.Y) / textArea.TextView.FontHeight;
            int lineNumber         = textArea.Document.GetFirstLogicalLine(clickedVisibleLine);

            if ((mouseButtons & MouseButtons.Left) == MouseButtons.Left)
            {
                ToggleBreakpointAt(lineNumber + 1);
            }
        }
Exemplo n.º 4
0
        static void IconBarMouseDown(AbstractMargin iconBar, Point mousepos, MouseButtons mouseButtons)
        {
            if (mouseButtons != MouseButtons.Left)
            {
                return;
            }
            Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
            Point     logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);

            if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
            {
                ToggleBreakpointAt(iconBar.TextArea.Document, iconBar.TextArea.MotherTextEditorControl.FileName, logicPos.Y);
                iconBar.TextArea.Refresh(iconBar);
            }
        }
Exemplo n.º 5
0
 public static void IconBarMouseDown(AbstractMargin iconBar, Point mousepos, MouseButtons mouseButtons)
 {
     try
     {
         if (mouseButtons != MouseButtons.Left)
         {
             if (mouseButtons == MouseButtons.Right)
             {
                 iconBar.TextArea.MotherTextEditorControl.ContextMenuStrip = null;
                 Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
                 ICSharpCode.TextEditor.TextLocation logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
                 if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
                 {
                     cur_bookmark = IsOnBreakpoint(iconBar.TextArea.Document, logicPos.Y);
                     if (cur_bookmark != null)
                     {
                         iconBar.TextArea.MotherTextEditorControl.ContextMenuStrip = VisualPABCSingleton.MainForm.BreakpointMenuStrip;
                     }
                 }
             }
             return;
         }
         else
         {
             Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
             //Point logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
             ICSharpCode.TextEditor.TextLocation logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
             if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
             {
                 string s = iconBar.TextArea.MotherTextEditorControl.FileName;
                 if (s == null)
                 {
                     s = TextAreaHelper.GetFileNameByTextArea(iconBar.TextArea);
                 }
                 ToggleBreakpointAt(iconBar.TextArea.Document, s, logicPos.Y);
                 iconBar.TextArea.Refresh(iconBar);
             }
         }
     }
     catch (System.Exception e)
     {
     }
 }
Exemplo n.º 6
0
        private void IconBarMouseDown(AbstractMargin iconBar, Point mousePos, MouseButtons mouseButtons)
        {
            if (mouseButtons == MouseButtons.Left)
            {
                TextLocation ALogicPos =
                    iconBar.TextArea.TextView.GetLogicalPosition
                    (
                        0,
                        mousePos.Y - iconBar.TextArea.TextView.DrawingPosition.Top
                    );

                if (ALogicPos.Y >= 0 && ALogicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines)
                {
                    var locator = Service.GetLocator();
                    if (locator != null)
                    {
                        Dataphoria.Debugger.ToggleBreakpoint(new DebugLocator(locator.Locator, ALogicPos.Line + 1, -1));
                    }
                }
            }
        }
Exemplo n.º 7
0
        private void IconBarMargin_MouseDown(AbstractMargin sender, Point mousepos, MouseButtons mouseButtons)
        {
            if (mouseButtons != MouseButtons.Left)
            {
                return;
            }

            var textArea = this.txtCode.ActiveTextAreaControl.TextArea;

            int yPos       = mousepos.Y;
            int lineHeight = textArea.TextView.FontHeight;
            int lineNumber = (yPos + textArea.VirtualTop.Y) / lineHeight;

            //是否已经存在该断点
            //if(this.txtCode.Document.BookmarkManager.Marks)

            //if (BreakPoints.Any(p => p.Line == lineNumber + 1) || lineNumber >= textArea.Document.TotalNumberOfLines)
            //    return;


            string text   = textArea.Document.GetText(textArea.Document.GetLineSegment(lineNumber));
            int    offset = -1;

            for (int i = 0; i < text.Length; i++)
            {
                if (
                    !Char.IsWhiteSpace(text[i]) &&
                    text[i] != '/'
                    )
                {
                    offset = i;
                    break;
                }
            }

            if (offset == -1)
            {
                return;
            }

            var breakPoint = new EditorBreakPoint(lineNumber + 1, offset);

            db.AddBreakPoint(breakPoint);

            var document = this.txtCode.Document;

            var mark = new BreakPointMark(
                document,
                new TextLocation(
                    offset,
                    lineNumber
                    )
                );

            mark.Removed += (s, e) =>
            {
                db.RemoveBreakPoint(breakPoint);
            };

            document.BookmarkManager.AddMark(mark);

            this.txtCode.Refresh();
        }
Exemplo n.º 8
0
        void IconBarMargin_MouseDown(AbstractMargin sender, Point mousepos, MouseButtons mouseButtons)
        {
            if (mouseButtons != MouseButtons.Left)
            {
                return;
            }

            var textArea = _textEditor.ActiveTextAreaControl.TextArea;

            int yPos       = mousepos.Y;
            int lineHeight = textArea.TextView.FontHeight;
            int lineNumber = (yPos + textArea.VirtualTop.Y) / lineHeight;

            if (BreakPoints.Any(p => p.Line == lineNumber + 1) || lineNumber >= textArea.Document.TotalNumberOfLines)
            {
                return;
            }

            string text   = textArea.Document.GetText(textArea.Document.GetLineSegment(lineNumber));
            int    offset = -1;

            for (int i = 0; i < text.Length; i++)
            {
                if (
                    !Char.IsWhiteSpace(text[i]) &&
                    text[i] != '/'
                    )
                {
                    offset = i;
                    break;
                }
            }

            if (offset == -1)
            {
                return;
            }

            var breakPoint = new EditorBreakPoint(lineNumber + 1, offset);

            BreakPoints.Add(breakPoint);

            if (_script != null)
            {
                breakPoint.BreakPoint = new BreakPoint(Script.Script, lineNumber + 1, offset);
                _script.Engine.BreakPoints.Add(breakPoint.BreakPoint);
            }

            var document = _textEditor.Document;

            var mark = new BreakPointMark(
                document,
                new TextLocation(
                    offset,
                    lineNumber
                    )
                );

            mark.Removed += (s, e) =>
            {
                BreakPoints.Remove(breakPoint);
                _script?.Engine.BreakPoints.Remove(breakPoint.BreakPoint);
            };

            document.BookmarkManager.AddMark(mark);

            _textEditor.Refresh();
        }