Esempio n. 1
0
        /// <summary>
        /// Sets the mark at the line <code>location.Line</code> if it is not set, if the
        /// line is already marked the mark is cleared.
        /// </summary>
        public void ToggleMarkAt(TextLocation location)
        {
            Bookmark newMark;

            if (Factory != null)
            {
                newMark = Factory.CreateBookmark(document, location);
            }
            else
            {
                newMark = new Bookmark(document, location);
            }

            Type newMarkType = newMark.GetType();

            for (int i = 0; i < bookmark.Count; ++i)
            {
                Bookmark mark = bookmark[i];

                if (mark.LineNumber == location.Line && mark.CanToggle && mark.GetType() == newMarkType)
                {
                    bookmark.RemoveAt(i);
                    OnRemoved(new BookmarkEventArgs(mark));
                    return;
                }
            }

            bookmark.Add(newMark);
            OnAdded(new BookmarkEventArgs(newMark));
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the mark at the line <code>lineNr</code> if it is not set, if the
        /// line is already marked the mark is cleared.
        /// </summary>
        public void ToggleMarkAt(int lineNr)
        {
            Bookmark newMark;

            if (factory != null)
            {
                newMark = factory.CreateBookmark(document, lineNr);
            }
            else
            {
                newMark = new Bookmark(document, lineNr);
            }

            Type newMarkType = newMark.GetType();

            for (int i = 0; i < bookmark.Count; ++i)
            {
                Bookmark mark = bookmark[i];

                if (mark.LineNumber == lineNr && mark.CanToggle && mark.GetType() == newMarkType)
                {
                    bookmark.RemoveAt(i);
                    OnRemoved(new BookmarkEventArgs(mark));
                    OnChanged(EventArgs.Empty);
                    return;
                }
            }

            bookmark.Add(newMark);
            OnAdded(new BookmarkEventArgs(newMark));
            OnChanged(EventArgs.Empty);
        }
        public void ToggleMarkAt(TextLocation location)
        {
            Bookmark bookmark;

            bookmark = (this.Factory == null ? new Bookmark(this.document, location) : this.Factory.CreateBookmark(this.document, location));
            Type type = bookmark.GetType();

            for (int i = 0; i < this.bookmark.Count; i++)
            {
                Bookmark item = this.bookmark[i];
                if (item.LineNumber == location.Line && item.CanToggle && item.GetType() == type)
                {
                    this.bookmark.RemoveAt(i);
                    this.OnRemoved(new BookmarkEventArgs(item));
                    return;
                }
            }
            this.bookmark.Add(bookmark);
            this.OnAdded(new BookmarkEventArgs(bookmark));
        }
        /// <summary>
        /// Sets the mark at the line <code>location.Line</code> if it is not set, if the
        /// line is already marked the mark is cleared.
        /// </summary>
        public void ToggleMarkAt(TextLocation location)
        {
            Bookmark newMark = new Bookmark(Document, location);

            Type newMarkType = newMark.GetType();

            for (int i = 0; i < _bookmark.Count; ++i)
            {
                Bookmark mark = _bookmark[i];

                if (mark.LineNumber == location.Line && mark.CanToggle && mark.GetType() == newMarkType)
                {
                    _bookmark.RemoveAt(i);
                    OnRemoved(new BookmarkEventArgs(mark));
                    return;
                }
            }

            _bookmark.Add(newMark);
            OnAdded(new BookmarkEventArgs(newMark));
        }