/// <summary> /// Called when lines were inserted in ScrollLinesHost. /// </summary> /// <param name="insertAt">Index of the first inserted line.</param> /// <param name="count">The count.</param> protected override void OnLinesInserted(int insertAt, int count) { if (distances != null) { DistancesUtil.OnInserted(distances, ScrollLinesHost, insertAt, count); } }
/// <summary> /// Inserts lines in the collection and raises the <see cref="LinesInserted"/> event. /// </summary> /// <param name="insertAtLine">The index of the first line to insert.</param> /// <param name="count">The count.</param> /// <param name="movelines">A container with saved state from a preceeding <see cref="RemoveLines"/> call when lines should be moved. When it is null empty lines with default size are inserted.</param> public void InsertLines(int insertAtLine, int count, IEditableLineSizeHost movelines) { var moveLines = (LineSizeCollection)movelines; lineSizes.Insert(insertAtLine, count, moveLines == null ? null : moveLines.lineSizes); lineHidden.Insert(insertAtLine, 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 >= insertAtLine) { lineNested.Add(entry.Key + count, entry.Value); } else { lineNested.Add(entry.Key, entry.Value); } } if (moveLines != null) { foreach (KeyValuePair <int, LineSizeCollection> entry in moveLines.lineNested) { lineNested.Add(entry.Key + insertAtLine, entry.Value); } } lineCount += count; if (IsSuspendUpdates) { return; } if (distances != null) { DistancesUtil.OnInserted(distances, this, insertAtLine, count); } if (LinesInserted != null) { LinesInserted(this, new LinesInsertedEventArgs(insertAtLine, count)); } }