Exemplo n.º 1
0
 public void AddBookmark()
 {
     if (!Bookmark.IsActive)
     {
         Bookmark.Click();
     }
     else
     {
         throw new TutorialBookmarkedException(Title);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Raises the <see cref="AbstractMargin.MouseDown"/> event.
        /// </summary>
        /// <param name="eventArgs">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        protected override void OnMouseDown(MouseEventArgs eventArgs)
        {
            Point        mousePos     = eventArgs.Location;
            MouseButtons mouseButtons = eventArgs.Button;

            int clickedVisibleLine = (mousePos.Y + TextArea.VirtualTop.Y) / TextArea.TextView.LineHeight;
            int lineNumber         = TextArea.Document.GetFirstLogicalLine(clickedVisibleLine);

            if ((mouseButtons & MouseButtons.Right) == MouseButtons.Right)
            {
                if (TextArea.Caret.Line != lineNumber)
                {
                    TextArea.Caret.Line = lineNumber;
                }
            }

            IList <Bookmark> marks       = TextArea.Document.BookmarkManager.Marks;
            List <Bookmark>  marksInLine = new List <Bookmark>();
            int oldCount = marks.Count;

            foreach (Bookmark mark in marks)
            {
                if (mark.LineNumber == lineNumber)
                {
                    marksInLine.Add(mark);
                }
            }

            for (int i = marksInLine.Count - 1; i >= 0; i--)
            {
                Bookmark mark = marksInLine[i];
                if (mark.Click(TextArea, eventArgs))
                {
                    if (oldCount != marks.Count)
                    {
                        TextArea.UpdateLine(lineNumber);
                    }

                    return;
                }
            }
            base.OnMouseDown(eventArgs);
        }
Exemplo n.º 3
0
        public override void HandleMouseDown(Point mousePos, MouseButtons mouseButtons)
        {
            int clickedVisibleLine = (mousePos.Y + textArea.VirtualTop.Y) / textArea.TextView.FontHeight;
            int lineNumber         = textArea.Document.GetFirstLogicalLine(clickedVisibleLine);

            if ((mouseButtons & MouseButtons.Right) == MouseButtons.Right)
            {
                if (textArea.Caret.Line != lineNumber)
                {
                    textArea.Caret.Line = lineNumber;
                }
            }

            IList <Bookmark> marks       = textArea.Document.BookmarkManager.Marks;
            List <Bookmark>  marksInLine = new List <Bookmark>();
            int oldCount = marks.Count;

            foreach (Bookmark mark in marks)
            {
                if (mark.LineNumber == lineNumber)
                {
                    marksInLine.Add(mark);
                }
            }

            for (int i = marksInLine.Count - 1; i >= 0; i--)
            {
                Bookmark mark = marksInLine[i];

                if (mark.Click(textArea, new MouseEventArgs(mouseButtons, 1, mousePos.X, mousePos.Y, 0)))
                {
                    if (oldCount != marks.Count)
                    {
                        textArea.UpdateLine(lineNumber);
                    }

                    return;
                }
            }

            base.HandleMouseDown(mousePos, mouseButtons);
        }
Exemplo n.º 4
0
        public override void HandleMouseDown(Point mousePos, MouseButtons mouseButtons)
        {
            int clickedVisibleLine = (mousePos.Y + textArea.VirtualTop.Y) / textArea.TextView.FontHeight;
            int lineNumber         = textArea.Document.GetFirstLogicalLine(clickedVisibleLine);

            if (textArea.Caret.Line != lineNumber)
            {
                textArea.Caret.Line = lineNumber;
            }

            IList <Bookmark> marks       = textArea.Document.BookmarkManager.Marks;
            List <Bookmark>  marksInLine = new List <Bookmark>();
            int oldBookCount             = marks.Count;

            foreach (Bookmark mark in marks)
            {
                if (mark.LineNumber == lineNumber)
                {
                    marksInLine.Add(mark);
                }
            }
            IList <Breakpoint> breaks       = textArea.Document.BreakpointManager.Marks;
            List <Breakpoint>  breaksInLine = new List <Breakpoint>();
            int oldBreakCount = breaks.Count;

            foreach (Breakpoint mark in breaks)
            {
                if (mark.LineNumber == lineNumber)
                {
                    breaksInLine.Add(mark);
                }
            }
            for (int i = marksInLine.Count - 1; i >= 0; i--)
            {
                Bookmark mark = marksInLine[i];
                if (!mark.Click(textArea, new MouseEventArgs(mouseButtons, 1, mousePos.X, mousePos.Y, 0)))
                {
                    continue;
                }
                if (oldBookCount != marks.Count)
                {
                    textArea.UpdateLine(lineNumber);
                }
                return;
            }
            for (int i = breaksInLine.Count - 1; i >= 0; i--)
            {
                Breakpoint mark = breaksInLine[i];
                if (!mark.Click(textArea, new MouseEventArgs(mouseButtons, 1, mousePos.X, mousePos.Y, 0)))
                {
                    continue;
                }
                if (oldBreakCount != marks.Count)
                {
                    textArea.UpdateLine(lineNumber);
                }
                return;
            }
            Breakpoint newBreak = new Breakpoint(textArea.Document, new TextLocation(0, lineNumber));

            newBreak.Click(textArea, new MouseEventArgs(mouseButtons, 1, mousePos.X, mousePos.Y, 0));
            textArea.UpdateLine(lineNumber);
            base.HandleMouseDown(mousePos, mouseButtons);
        }