/// <summary>
        /// Removes lines from the collection and raises the <see cref="LinesRemoved"/> event.
        /// </summary>
        /// <param name="removeAtLine">The index of the first line to be removed.</param>
        /// <param name="count">The count.</param>
        /// <param name="movelines">A container to save state for a subsequent <see cref="InsertLines"/> call when lines should be moved.</param>
        public void RemoveLines(int removeAtLine, int count, IEditableLineSizeHost movelines)
        {
            var moveLines = (LineSizeCollection)movelines;

            lineSizes.Remove(removeAtLine, count, moveLines == null ? null : moveLines.lineSizes);
            lineHidden.Remove(removeAtLine, count, moveLines == null ? null : moveLines.lineHidden);

            Dictionary <int, LineSizeCollection> _lineNested = lineNested;

            lineNested = new Dictionary <int, LineSizeCollection>();

            foreach (KeyValuePair <int, LineSizeCollection> entry in _lineNested)
            {
                if (entry.Key >= removeAtLine)
                {
                    if (entry.Key >= removeAtLine + count)
                    {
                        lineNested.Add(entry.Key - count, entry.Value);
                    }
                    else if (moveLines != null)
                    {
                        moveLines.lineNested.Add(entry.Key - removeAtLine, entry.Value);
                    }
                }
                else
                {
                    lineNested.Add(entry.Key, entry.Value);
                }
            }

            lineCount -= count;

            if (IsSuspendUpdates)
            {
                return;
            }

            if (distances != null)
            {
                distances.Remove(removeAtLine, count);
            }

            if (LinesRemoved != null)
            {
                LinesRemoved(this, new LinesRemovedEventArgs(removeAtLine, count));
            }
        }
Beispiel #2
0
 /// <summary>
 /// Removes enities from the collection.
 /// </summary>
 /// <param name="removeAt">Index of the first entity to be removed.</param>
 /// <param name="count">The number of entities to be removed.</param>
 public void Remove(int removeAt, int count)
 {
     trackDCC.Remove(removeAt + start, count);
 }