/// <summary> /// Collects the last dropped DropMarker /// </summary> /// <remarks> /// When a DropMarker is collected the current document posision is moved /// to the DropMarker posision, the DropMarker is removed from the stack /// and the visual indicator is removed. /// </remarks> public void Collect() { while (_markerStack.Count > 0) { DropMarker dm = _markerStack.Pop(); // If the Drop Marker was deleted in the document by // a user action it will be disposed but not removed // from the marker stack. In this case just pretend // like it doesn't exist and go on to the next one if (dm.IsDisposed) { continue; } // The MarkerCollection fires a cancellable event. // If it is canclled the Collect() method will return // false. In this case we need to push the marker back // on the stack so that it will still be collected in // the future. if (!dm.Collect()) { _markerStack.Push(dm); } return; } }
/// <summary> /// Drops a DropMarker at the specified document position /// </summary> /// <param name="position"></param> /// <returns>The newly created DropMarker</returns> /// <remarks> /// Dropping a DropMarker creates a visual marker (red triangle) /// indicating the DropMarker point. /// </remarks> public DropMarker Drop(int position) { DropMarker dm = new DropMarker(position, position, GetCurrentTopOffset(), Scintilla); _allDocumentDropMarkers.Add(dm); _markerStack.Push(dm); Scintilla.ManagedRanges.Add(dm); // Force the Drop Marker to paint Scintilla.Invalidate(dm.GetClientRectangle()); return(dm); }
/// <summary> /// Drops a DropMarker at the specified document position /// </summary> /// <param name="position"></param> /// <returns>The newly created DropMarker</returns> /// <remarks> /// Dropping a DropMarker creates a visual marker (red triangle) /// indicating the DropMarker point. /// </remarks> public DropMarker Drop(int position) { DropMarker dm = new DropMarker(position, position, GetCurrentTopOffset(), Scintilla); _allDocumentDropMarkers.Add(dm); _markerStack.Push(dm); Scintilla.ManagedRanges.Add(dm); // Force the Drop Marker to paint Scintilla.Invalidate(dm.GetClientRectangle()); return dm; }
/// <summary> /// Initializes a new instance of the DropMarkerCollectEventArgs class. /// </summary> public DropMarkerCollectEventArgs(DropMarker dropMarker) { _dropMarker = dropMarker; }