diff --git a/src/Main/Base/Project/Src/Editor/AvalonEdit/PinLayer.cs b/src/Main/Base/Project/Src/Editor/AvalonEdit/PinLayer.cs deleted file mode 100644 index cd9294889e..0000000000 --- a/src/Main/Base/Project/Src/Editor/AvalonEdit/PinLayer.cs +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Media; - -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Rendering; -using ICSharpCode.SharpDevelop.Refactoring; -using Services.Debugger.Tooltips; - -namespace Editor.AvalonEdit -{ - /// - /// Pin layer class. This class handles the pinning and unpinning operations. - /// - public class PinLayer : Layer - { - private Canvas pinningSurface; - - private double verticalOffset = 0; - - /// - /// PinLayer constructor. - /// - /// Text area for this layer. - public PinLayer(TextArea textArea) : base(textArea.TextView, KnownLayer.DataPins) - { - pinningSurface = new Canvas(); - this.Children.Add(pinningSurface); - textView.VisualLinesChanged += new EventHandler(textView_VisualLinesChanged); - } - - /// - /// Pins an element; - /// - /// Element to pin. - public void Pin(PinDebuggerControl element) - { - if (element == null) - throw new NullReferenceException("Element is null!"); - - Thumb currentThumb = new Thumb(); - // check for saved position - if (!element.Mark.PinPosition.HasValue) { - // this is satisfied when pinning the first time - element.Mark.PinPosition = new Point { - X = element.Location.X + textView.HorizontalOffset, - Y = element.Location.Y + textView.VerticalOffset - }; - - Canvas.SetTop(currentThumb, element.Location.Y); - Canvas.SetLeft(currentThumb, element.Location.X); - } - else { - // this is satisfied when loading the pins - so we might have hidden pins - element.Location = new Point { - X = element.Mark.PinPosition.Value.X - textView.HorizontalOffset, - Y = element.Mark.PinPosition.Value.Y - textView.VerticalOffset - }; - - Canvas.SetTop(currentThumb, element.Mark.PinPosition.Value.Y); - Canvas.SetLeft(currentThumb, element.Mark.PinPosition.Value.X); - } - - currentThumb.Style = element.TryFindResource("PinThumbStyle") as Style; - currentThumb.ApplyTemplate(); - currentThumb.DragDelta += onDragDelta; - currentThumb.DragStarted += currentThumb_DragStarted; - currentThumb.DragCompleted += currentThumb_DragCompleted; - - var container = TryFindChild(currentThumb); - container.Children.Add(element); - pinningSurface.Children.Add(currentThumb); - } - - /// - /// Unpins an element. - /// - /// Element to unpin. - public void Unpin(PinDebuggerControl element) - { - if (element == null) - throw new NullReferenceException("Element is null!"); - - foreach (var thumb in this.pinningSurface.Children) { - PinDebuggerControl pinControl = TryFindChild((DependencyObject)thumb); - if (pinControl != null && pinControl == element) - { - pinningSurface.Children.Remove((UIElement)thumb); - break; - } - } - } - - void textView_VisualLinesChanged(object sender, EventArgs e) - { - foreach (var ctrl in this.pinningSurface.Children) { - var currentThumb = ctrl as Thumb; - PinDebuggerControl pinControl = TryFindChild(currentThumb); - if (pinControl != null) - { - // update relative location - Point location = pinControl.Location; - location.X -= textView.HorizontalOffset; - location.Y += verticalOffset - textView.VerticalOffset; - - Canvas.SetLeft(currentThumb, location.X); - Canvas.SetTop(currentThumb, location.Y); - - pinControl.Location = location; - pinControl.Mark.PinPosition = new Point { - X = location.X + textView.HorizontalOffset, - Y = location.Y + textView.VerticalOffset, - }; - } - } - - verticalOffset = textView.VerticalOffset; - } - - #region Mouse move - - void onDragDelta(object sender, DragDeltaEventArgs e) - { - Thumb currnetThumb = (Thumb)sender; - currnetThumb.Cursor = Cursors.Arrow; - double left = Canvas.GetLeft(currnetThumb) + e.HorizontalChange; - double top = Canvas.GetTop(currnetThumb) + e.VerticalChange; - - Canvas.SetLeft(currnetThumb, left); - Canvas.SetTop(currnetThumb, top); - } - - void currentThumb_DragCompleted(object sender, DragCompletedEventArgs e) - { - Thumb currnetThumb = (Thumb)sender; - currnetThumb.Cursor = Cursors.Arrow; - - var pinControl = TryFindChild(currnetThumb); - if (pinControl != null) { - double left = Canvas.GetLeft(currnetThumb); - double top = Canvas.GetTop(currnetThumb); - pinControl.Opacity = 1d; - pinControl.Location = new Point { X = left, Y = top }; - - // pin's position is with respect to the layer. - pinControl.Mark.PinPosition = - new Point - { - X = textView.HorizontalOffset + left, - Y = textView.VerticalOffset + top - }; - } - } - - void currentThumb_DragStarted(object sender, DragStartedEventArgs e) - { - Thumb currnetThumb = (Thumb)sender; - currnetThumb.Cursor = Cursors.Arrow; - - var pinControl = TryFindChild(currnetThumb); - if (pinControl != null) - pinControl.Opacity = 1d; - } - - #endregion - - #region Static helpers - - static T TryFindChild(DependencyObject root) where T : DependencyObject - { - return ContextActionsControl.SearchVisualTree(root); - } - - static T TryFindParent(DependencyObject child) where T : DependencyObject - { - if (child is T) return child as T; - - DependencyObject parentObject = GetParentObject(child); - if (parentObject == null) return null; - - var parent = parentObject as T; - if (parent != null && parent is T) - { - return parent; - } - else - { - return TryFindParent(parentObject); - } - } - - static DependencyObject GetParentObject(DependencyObject child) - { - if (child == null) return null; - - ContentElement contentElement = child as ContentElement; - if (contentElement != null) - { - DependencyObject parent = ContentOperations.GetParent(contentElement); - if (parent != null) return parent; - - FrameworkContentElement fce = contentElement as FrameworkContentElement; - return fce != null ? fce.Parent : null; - } - - FrameworkElement frameworkElement = child as FrameworkElement; - if (frameworkElement != null) - { - DependencyObject parent = frameworkElement.Parent; - if (parent != null) return parent; - } - - return VisualTreeHelper.GetParent(child); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs deleted file mode 100644 index 2a04967115..0000000000 --- a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls.Primitives; -using System.Windows.Input; - -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop.Gui; - -namespace ICSharpCode.SharpDevelop.Debugging -{ - /// - /// Popup containing . - /// - public class DebuggerPopup : Popup - { - internal DebuggerTooltipControl contentControl; - - public DebuggerPopup(DebuggerTooltipControl parentControl, bool showPins = true) - { - this.contentControl = new DebuggerTooltipControl(parentControl, showPins); - this.contentControl.containingPopup = this; - this.Child = this.contentControl; - this.IsLeaf = false; - - //this.KeyDown += new KeyEventHandler(DebuggerPopup_KeyDown); - - //this.contentControl.Focusable = true; - //Keyboard.Focus(this.contentControl); - //this.AllowsTransparency = true; - //this.PopupAnimation = PopupAnimation.Slide; - } - - // attempt to propagate shortcuts to main windows when Popup is focusable (needed for keyboard scrolling + editing) - /*void DebuggerPopup_KeyDown(object sender, KeyEventArgs e) - { - LoggingService.Debug("Unhandled popup key down: " + e.Key); - RaiseEventPair(WorkbenchSingleton.MainWindow, PreviewKeyDownEvent, KeyDownEvent, - new KeyEventArgs(e.KeyboardDevice, e.InputSource, e.Timestamp, e.Key)); - } - - // copied from CompletionWindowBase - static bool RaiseEventPair(UIElement target, RoutedEvent previewEvent, RoutedEvent @event, RoutedEventArgs args) - { - if (target == null) - throw new ArgumentNullException("target"); - if (previewEvent == null) - throw new ArgumentNullException("previewEvent"); - if (@event == null) - throw new ArgumentNullException("event"); - if (args == null) - throw new ArgumentNullException("args"); - args.RoutedEvent = previewEvent; - target.RaiseEvent(args); - args.RoutedEvent = @event; - target.RaiseEvent(args); - return args.Handled; - }*/ - - public IEnumerable ItemsSource - { - get { return this.contentControl.ItemsSource; } - set { this.contentControl.SetItemsSource(value); } - } - - private bool isLeaf; - public bool IsLeaf - { - get { return isLeaf; } - set - { - isLeaf = value; - // leaf popup closes on lost focus - this.StaysOpen = !isLeaf; - } - } - - protected override void OnClosed(EventArgs e) - { - base.OnClosed(e); - if (isLeaf) { - this.contentControl.CloseOnLostFocus(); - } - } - - public void Open() - { - this.IsOpen = true; - } - - public void CloseSelfAndChildren() - { - this.contentControl.CloseChildPopups(); - this.IsOpen = false; - } - } -} \ No newline at end of file diff --git a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml deleted file mode 100644 index b6bd8d756a..0000000000 --- a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml.cs b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml.cs deleted file mode 100644 index eb94a606b5..0000000000 --- a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml.cs +++ /dev/null @@ -1,403 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -using ICSharpCode.Core; -using ICSharpCode.NRefactory; -using ICSharpCode.SharpDevelop.Bookmarks; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Gui; -using Services.Debugger.Tooltips; - -namespace ICSharpCode.SharpDevelop.Debugging -{ - /// - /// Default Control used as content of SharpDevelop debugger tooltips. - /// - public partial class DebuggerTooltipControl : UserControl, ITooltip - { - private const double ChildPopupOpenXOffet = 16; - private const double ChildPopupOpenYOffet = 15; - private const int InitialItemsCount = 12; - private const int VisibleItemsCount = 11; - - private bool showPins = true; - private LazyItemsControl lazyGrid; - private IEnumerable itemsSource; - - public DebuggerTooltipControl() - { - InitializeComponent(); - - Loaded += new RoutedEventHandler(OnLoaded); - } - - public DebuggerTooltipControl(ITreeNode node) - : this(new ITreeNode[] { node }) - { - - } - - public DebuggerTooltipControl(IEnumerable nodes) - : this() - { - this.itemsSource = nodes; - } - - public DebuggerTooltipControl(DebuggerTooltipControl parentControl, bool showPins = true) - : this() - { - this.parentControl = parentControl; - this.showPins = showPins; - } - - private void OnLoaded(object sender, RoutedEventArgs e) - { - if (!showPins) { - dataGrid.Columns[5].Visibility = Visibility.Collapsed; - } - - SetItemsSource(this.itemsSource); - } - - public event RoutedEventHandler Closed; - protected void OnClosed() - { - if (this.Closed != null) { - this.Closed(this, new RoutedEventArgs()); - } - } - - public IEnumerable ItemsSource { - get { return this.itemsSource; } - } - - public void SetItemsSource(IEnumerable value) { - this.itemsSource = value; - this.lazyGrid = new LazyItemsControl(this.dataGrid, InitialItemsCount); - - // HACK for updating the pins in tooltip - var observable = new List(); - this.itemsSource.ForEach(item => observable.Add(item)); - - // verify if at the line of the root there's a pin bookmark - ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider; - var editor = provider.TextEditor; - if (editor != null) { - var pin = BookmarkManager.Bookmarks.Find( - b => b is PinBookmark && - b.Location.Line == LogicalPosition.Line && - b.FileName == editor.FileName) as PinBookmark; - - if (pin != null) { - observable.ForEach(item => { // TODO: find a way not to use "observable" - if (pin.ContainsNode(item)) - item.IsPinned = true; - }); - } - } - - var source = new VirtualizingIEnumerable(observable); - lazyGrid.ItemsSource = source; - this.dataGrid.AddHandler(ScrollViewer.ScrollChangedEvent, new ScrollChangedEventHandler(handleScroll)); - - if (this.lazyGrid.ItemsSourceTotalCount != null) { - // hide up/down buttons if too few items - btnUp.Visibility = btnDown.Visibility = - this.lazyGrid.ItemsSourceTotalCount.Value <= VisibleItemsCount ? Visibility.Collapsed : Visibility.Visible; - } - } - - public Location LogicalPosition { get; set; } - - /// - public bool ShowAsPopup - { - get - { - return true; - } - } - - /// - public bool Close(bool mouseClick) - { - if (mouseClick || (!mouseClick && !isChildExpanded)) { - CloseChildPopups(); - return true; - } else { - return false; - } - } - - private DebuggerPopup childPopup { get; set; } - private DebuggerTooltipControl parentControl { get; set; } - internal DebuggerPopup containingPopup { get; set; } - - bool isChildExpanded - { - get - { - return this.childPopup != null && this.childPopup.IsOpen; - } - } - - private ToggleButton expandedButton; - - /// - /// Closes the child popup of this control, if it exists. - /// - public void CloseChildPopups() - { - if (this.expandedButton != null) { - this.expandedButton.IsChecked = false; - this.expandedButton = null; - // nice simple example of indirect recursion - this.childPopup.CloseSelfAndChildren(); - } - } - - public void CloseOnLostFocus() - { - // when we close, parent becomes leaf - if (this.containingPopup != null) { - this.containingPopup.IsLeaf = true; - } - if (!this.IsMouseOver) { - if (this.containingPopup != null) { - this.containingPopup.IsOpen = false; - this.containingPopup.IsLeaf = false; - } - if (this.parentControl != null) { - this.parentControl.CloseOnLostFocus(); - } - OnClosed(); - } else { - // leaf closed because of click inside this control - stop the closing chain - if (this.expandedButton != null && !this.expandedButton.IsMouseOver) { - this.expandedButton.IsChecked = false; - this.expandedButton = null; - } - } - } - - private void btnExpander_Click(object sender, RoutedEventArgs e) - { - var clickedButton = (ToggleButton)e.OriginalSource; - var clickedNode = (ITreeNode)clickedButton.DataContext; - // use device independent units, because child popup Left/Top are in independent units - Point buttonPos = clickedButton.PointToScreen(new Point(0, 0)).TransformFromDevice(clickedButton); - - if (clickedButton.IsChecked.GetValueOrDefault(false)) { - CloseChildPopups(); - this.expandedButton = clickedButton; - - // open child Popup - if (this.childPopup == null) { - this.childPopup = new DebuggerPopup(this); - this.childPopup.Placement = PlacementMode.Absolute; - this.childPopup.contentControl.LogicalPosition = LogicalPosition; - } - if (this.containingPopup != null) { - this.containingPopup.IsLeaf = false; - } - this.childPopup.IsLeaf = true; - this.childPopup.HorizontalOffset = buttonPos.X + ChildPopupOpenXOffet; - this.childPopup.VerticalOffset = buttonPos.Y + ChildPopupOpenYOffet; - this.childPopup.ItemsSource = clickedNode.ChildNodes; - this.childPopup.Open(); - } else { - CloseChildPopups(); - } - } - - private void handleScroll(object sender, ScrollChangedEventArgs e) - { - btnUp.IsEnabled = !this.lazyGrid.IsScrolledToStart; - btnDown.IsEnabled = !this.lazyGrid.IsScrolledToEnd; - } - - void BtnUp_Click(object sender, RoutedEventArgs e) - { - this.lazyGrid.ScrollViewer.ScrollUp(1); - } - - void BtnDown_Click(object sender, RoutedEventArgs e) - { - this.lazyGrid.ScrollViewer.ScrollDown(1); - } - - #region Edit value in tooltip - - void TextBox_KeyUp(object sender, KeyEventArgs e) - { - if (e.Key == Key.Escape) { - dataGrid.Focus(); - return; - } - - if (e.Key == Key.Enter) { - dataGrid.Focus(); - // set new value - var textBox = (TextBox)e.OriginalSource; - var newValue = textBox.Text; - var node = ((FrameworkElement)sender).DataContext as ITreeNode; - SaveNewValue(node, textBox.Text); - } - } - - void TextBox_LostFocus(object sender, RoutedEventArgs e) - { - var textBox = (TextBox)e.OriginalSource; - var newValue = textBox.Text; - var node = ((FrameworkElement)sender).DataContext as ITreeNode; - SaveNewValue(node, textBox.Text); - } - - void SaveNewValue(ITreeNode node, string newValue) - { - if(node != null && node.SetText(newValue)) { - // show adorner - var adornerLayer = AdornerLayer.GetAdornerLayer(dataGrid); - var adorners = adornerLayer.GetAdorners(dataGrid); - if (adorners != null && adorners.Length != 0) - adornerLayer.Remove(adorners[0]); - SavedAdorner adorner = new SavedAdorner(dataGrid); - adornerLayer.Add(adorner); - } - } - - #endregion - - #region Pining checked/unchecked - - void PinButton_Checked(object sender, RoutedEventArgs e) - { - ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider; - var editor = provider.TextEditor; - if (editor == null) return; - var node = (ITreeNode)(((ToggleButton)(e.OriginalSource)).DataContext); - - if (!string.IsNullOrEmpty(editor.FileName)) { - - // verify if at the line of the root there's a pin bookmark - var pin = BookmarkManager.Bookmarks.Find( - b => b is PinBookmark && - b.LineNumber == LogicalPosition.Line && - b.FileName == editor.FileName) as PinBookmark; - - if (pin == null) { - pin = new PinBookmark(editor.FileName, LogicalPosition); - // show pinned DebuggerPopup - if (pin.Popup == null) { - pin.Popup = new PinDebuggerControl(); - pin.Popup.Mark = pin; - Rect rect = new Rect(this.DesiredSize); - var point = this.PointToScreen(rect.TopRight); - pin.Popup.Location = new Point { X = 500, Y = point.Y - 150 }; - pin.Nodes.Add(node); - } - - // do actions - pin.Popup.Open(); - BookmarkManager.AddMark(pin); - } - else - { - if (!pin.ContainsNode(node)) - pin.Nodes.Add(node); - } - - pin.Popup.ItemsSource = pin.Nodes; - } - } - - void PinButton_Unchecked(object sender, RoutedEventArgs e) - { - ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider; - var editor = provider.TextEditor; - if (editor == null) return; - - if (!string.IsNullOrEmpty(editor.FileName)) { - // remove from pinned DebuggerPopup - var pin = BookmarkManager.Bookmarks.Find( - b => b is PinBookmark && - b.LineNumber == LogicalPosition.Line && - b.FileName == editor.FileName) as PinBookmark; - if (pin == null) return; - - ToggleButton button = (ToggleButton)e.OriginalSource; - pin.RemoveNode((ITreeNode)button.DataContext); - pin.Popup.ItemsSource = pin.Nodes; - // remove if no more data pins are available - if (pin.Nodes.Count == 0) { - pin.Popup.Close(); - - BookmarkManager.RemoveMark(pin); - } - } - } - - #endregion - - #region Saved Adorner - - class SavedAdorner : Adorner - { - public SavedAdorner(UIElement adornedElement) : base(adornedElement) - { - Loaded += delegate { Show(); }; - } - - protected override void OnRender(DrawingContext drawingContext) - { - Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize); - - // Some arbitrary drawing implements. - var formatedText = new FormattedText(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Debugging.SavedString}"), - CultureInfo.CurrentCulture, - FlowDirection.LeftToRight, - new Typeface(new FontFamily("Arial"), - FontStyles.Normal, - FontWeights.Black, - FontStretches.Expanded), - 8d, - Brushes.Black); - - - drawingContext.DrawText(formatedText, - new Point(adornedElementRect.TopRight.X - formatedText.Width - 2, - adornedElementRect.TopRight.Y)); - } - - private void Show() - { - DoubleAnimation animation = new DoubleAnimation(); - animation.From = 1; - animation.To = 0; - - animation.Duration = new Duration(TimeSpan.FromSeconds(2)); - animation.SetValue(Storyboard.TargetProperty, this); - animation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Rectangle.OpacityProperty)); - - Storyboard board = new Storyboard(); - board.Children.Add(animation); - - board.Begin(this); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/LazyItemsControl.cs b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/LazyItemsControl.cs deleted file mode 100644 index d769bfafb8..0000000000 --- a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/LazyItemsControl.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using System; -using System.Collections.Generic; -using System.Windows.Controls; - -namespace ICSharpCode.SharpDevelop.Debugging -{ - /// - /// ItemsControl wrapper that takes VirtualizingIEnumerable as source, - /// and adds additional items from the source to underlying ItemsControl when scrolled to bottom. - /// - public class LazyItemsControl - { - private ItemsControl itemsControl; - private int initialItemsCount; - - /// - /// Creates new instance of LazyItemsControl. - /// - /// ItemsControl to wrap and add items to it when scrolled to bottom. - /// Number of items to be initially displayed in wrapped ItemsControl. - public LazyItemsControl(ItemsControl wrappedItemsControl, int initialItemsCount) - { - if (wrappedItemsControl == null) - throw new ArgumentNullException("wrappedItemsControl"); - - this.initialItemsCount = initialItemsCount; - this.itemsControl = wrappedItemsControl; - this.itemsControl.AddHandler(ScrollViewer.ScrollChangedEvent, new ScrollChangedEventHandler(handleScroll)); - } - - private ScrollViewer scrollViewerCached; - public ScrollViewer ScrollViewer - { - get - { - if (this.scrollViewerCached == null) - this.scrollViewerCached = this.itemsControl.GetScrollViewer(); - return this.scrollViewerCached; - } - } - - public bool IsScrolledToStart - { - get - { - if (ScrollViewer == null) // Visual tree not initialized yet - return false; - return ScrollViewer.VerticalOffset == 0; - } - } - - public bool IsScrolledToEnd - { - get - { - if (itemsSourceTotalCount == null) { - // not scrolled to end of IEnumerable yet - return false; - } - // already scrolled to end of IEnumerable - int totalItems = itemsSourceTotalCount.Value; - return (ScrollViewer.VerticalOffset >= totalItems - ScrollViewer.ViewportHeight); - } - } - - private int? itemsSourceTotalCount = null; - /// Items count of underlying IEnumerable. Null until scrolled to the end of IEnumerable. - public int? ItemsSourceTotalCount - { - get - { - return this.itemsSourceTotalCount; - } - } - - private VirtualizingIEnumerable itemsSource; - /// The collection that underlying ItemsControl sees. - public VirtualizingIEnumerable ItemsSource - { - get { return itemsSource; } - set - { - this.itemsSource = value; - addNextItems(this.itemsSource, initialItemsCount); - this.itemsControl.ItemsSource = value; - } - } - - private void addNextItems(VirtualizingIEnumerable sourceToAdd, int nItems) - { - sourceToAdd.AddNextItems(nItems); - if (!sourceToAdd.HasNext) { - // all items from IEnumerable have been added - this.itemsSourceTotalCount = sourceToAdd.Count; - } - } - - private void handleScroll(object sender, ScrollChangedEventArgs e) - { - if (e.VerticalChange > 0) { - // scrolled to bottom - if (e.VerticalOffset >= this.itemsSource.Count - e.ViewportHeight) { - addNextItems(this.itemsSource, (int)e.VerticalChange); - } - } - } - } -} diff --git a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinCloseControl.xaml b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinCloseControl.xaml deleted file mode 100644 index 9b97989108..0000000000 --- a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinCloseControl.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - -