Example #1
0
		public void AddMark(SDBookmark bookmark, IDocument document, int line)
		{
			int lineStartOffset = document.GetLineByNumber(line).Offset;
			int column = 1 + DocumentUtilities.GetWhitespaceAfter(document, lineStartOffset).Length;
			bookmark.Location = new TextLocation(line, column);
			bookmark.FileName = FileName.Create(document.FileName);
			AddMark(bookmark);
		}
        public void AddMark(SDBookmark bookmark, IDocument document, int line)
        {
            int lineStartOffset = document.GetLineByNumber(line).Offset;
            int column          = 1 + DocumentUtilities.GetWhitespaceAfter(document, lineStartOffset).Length;

            bookmark.Location = new TextLocation(line, column);
            bookmark.FileName = FileName.Create(document.FileName);
            AddMark(bookmark);
        }
 public void AddMark(SDBookmark bookmark)
 {
     SD.MainThread.VerifyAccess();
     if (bookmark == null) return;
     if (bookmarks.Contains(bookmark)) return;
     if (bookmarks.Exists(b => IsEqualBookmark(b, bookmark))) return;
     bookmarks.Add(bookmark);
     OnAdded(new BookmarkEventArgs(bookmark));
 }
 public void Clear()
 {
     SD.MainThread.VerifyAccess();
     while (bookmarks.Count > 0)
     {
         SDBookmark b = bookmarks[bookmarks.Count - 1];
         bookmarks.RemoveAt(bookmarks.Count - 1);
         OnRemoved(new BookmarkEventArgs(b));
     }
 }
Example #5
0
		static bool IsEqualBookmark(SDBookmark a, SDBookmark b)
		{
			if (a == b)
				return true;
			if (a == null || b == null)
				return false;
			if (a.GetType() != b.GetType())
				return false;
			if (a.FileName != b.FileName)
				return false;
			return a.LineNumber == b.LineNumber;
		}
 public void AddMark(SDBookmark bookmark)
 {
     SD.MainThread.VerifyAccess();
     if (bookmark == null)
     {
         return;
     }
     if (bookmarks.Contains(bookmark))
     {
         return;
     }
     if (bookmarks.Exists(b => IsEqualBookmark(b, bookmark)))
     {
         return;
     }
     bookmarks.Add(bookmark);
     OnAdded(new BookmarkEventArgs(bookmark));
 }
        public void RemoveAll(Predicate <SDBookmark> match)
        {
            if (match == null)
            {
                throw new ArgumentNullException("Predicate is null!");
            }
            SD.MainThread.VerifyAccess();

            for (int index = bookmarks.Count - 1; index >= 0; --index)
            {
                SDBookmark bookmark = bookmarks[index];
                if (match(bookmark))
                {
                    bookmarks.RemoveAt(index);
                    OnRemoved(new BookmarkEventArgs(bookmark));
                }
            }
        }
 static bool IsEqualBookmark(SDBookmark a, SDBookmark b)
 {
     if (a == b)
     {
         return(true);
     }
     if (a == null || b == null)
     {
         return(false);
     }
     if (a.GetType() != b.GetType())
     {
         return(false);
     }
     if (a.FileName != b.FileName)
     {
         return(false);
     }
     return(a.LineNumber == b.LineNumber);
 }
        protected BookmarkPadBase()
        {
            this.control = new BookmarkPadContent();
            this.control.InitializeComponent();

            SD.BookmarkManager.BookmarkAdded   += BookmarkManagerAdded;
            SD.BookmarkManager.BookmarkRemoved += BookmarkManagerRemoved;

            foreach (SDBookmark bookmark in SD.BookmarkManager.Bookmarks)
            {
                if (ShowBookmarkInThisPad(bookmark))
                {
                    this.Items.Add(bookmark);
                }
            }

            this.control.listView.MouseDoubleClick += delegate {
                SDBookmark bm = this.control.listView.SelectedItem as SDBookmark;
                if (bm != null)
                {
                    OnItemActivated(bm);
                }
            };

            this.control.listView.KeyDown += delegate(object sender, System.Windows.Input.KeyEventArgs e) {
                var selectedItems = this.SelectedItems.ToList();
                if (!selectedItems.Any())
                {
                    return;
                }
                switch (e.Key)
                {
                case System.Windows.Input.Key.Delete:
                    foreach (var selectedItem in selectedItems)
                    {
                        SD.BookmarkManager.RemoveMark(selectedItem);
                    }
                    break;
                }
            };
        }
Example #10
0
 protected abstract bool ShowBookmarkInThisPad(SDBookmark mark);
Example #11
0
 protected virtual void OnItemActivated(SDBookmark bm)
 {
     FileService.JumpToFilePosition(bm.FileName, bm.LineNumber, 1);
 }
Example #12
0
		protected override bool ShowBookmarkInThisPad(SDBookmark bookmark)
		{
			return bookmark.IsVisibleInBookmarkPad && !(bookmark is BreakpointBookmark);
		}
Example #13
0
		public BookmarkEventArgs(SDBookmark bookmark)
		{
			this.bookmark = bookmark;
		}
Example #14
0
 protected virtual void OnItemActivated(SDBookmark bm)
 {
     FileService.JumpToFilePosition(bm.FileName, bm.LineNumber, 1);
 }
Example #15
0
 protected override bool ShowBookmarkInThisPad(SDBookmark bookmark)
 {
     return bookmark.ShowInPad(this);
 }
 public BookmarkEventArgs(SDBookmark bookmark)
 {
     this.bookmark = bookmark;
 }
Example #17
0
		protected override bool ShowBookmarkInThisPad(SDBookmark mark)
		{
			return mark.ShowInPad(this) && mark is BreakpointBookmark;
		}
Example #18
0
 protected abstract bool ShowBookmarkInThisPad(SDBookmark mark);
 public void RemoveMark(SDBookmark bookmark)
 {
     SD.MainThread.VerifyAccess();
     bookmarks.Remove(bookmark);
     OnRemoved(new BookmarkEventArgs(bookmark));
 }
Example #20
0
 protected override bool ShowBookmarkInThisPad(SDBookmark bookmark)
 {
     return(bookmark.ShowInPad(this));
 }
 public void RemoveMark(SDBookmark bookmark)
 {
     SD.MainThread.VerifyAccess();
     bookmarks.Remove(bookmark);
     OnRemoved(new BookmarkEventArgs(bookmark));
 }