/// <summary> /// Processes the lines inserted. This will never be called inside the /// access' write lock. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="LineRangeEventArgs"/> instance containing the event data.</param> private void ProcessLinesInserted( object sender, LineRangeEventArgs args) { // Make sure we're on the proper thread. CheckGuiThread(); // Create a short list of new cache items for the line. Since we are // dealing with indexes, we need to get the count. int count = args.EndLineIndex - args.StartLineIndex + 1; var newLines = new CachedLine[count]; for (int index = 0; index < count; index++) { newLines[index] = new CachedLine(); } // Insert the lines into the array. lines.InsertRange(args.StartLineIndex, newLines); // Call the base implementation to cascade the events up. base.OnLinesInserted(sender, args); }
/// <summary> /// Raises the <see cref="LinesInserted"/> event. /// </summary> /// <param name="e">The e.</param> protected virtual void RaiseLinesInserted(LineRangeEventArgs e) { EventHandler <LineRangeEventArgs> listeners = LinesInserted; if (listeners != null) { listeners(this, e); } }
/// <summary> /// Called when the inner buffer deletes lines. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The args.</param> protected override void OnLinesDeleted( object sender, LineRangeEventArgs args) { // Queue up a line change since we need to keep track of the changes // but this might be called while another thread is locked. QueueLineEvent(() => ProcessLinesDeleted(sender, args)); // Attempt to resolve the updates. This will do nothing if a lock // is currently acquired. Application.Invoke(ProcessQueuedLineChanges); }
/// <summary> /// Called when the inner buffer inserts lines. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The args.</param> protected override void OnLinesInserted( object sender, LineRangeEventArgs args) { // Queue up a line change since we need to keep track of the changes // but this might be called while another thread is locked. QueueLineEvent(() => ProcessLinesInserted(sender, args)); // Attempt to resolve the updates. This will do nothing if a lock // is currently acquired. Application.Invoke(ProcessQueuedLineChanges); // Start the background cacher to handle the lines that aren't // visible on screen. backgroundUpdater.Restart(); }
/// <summary> /// Processes the lines deleted. This will never be called inside the /// access' write lock. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="LineRangeEventArgs"/> instance containing the event data.</param> private void ProcessLinesDeleted( object sender, LineRangeEventArgs args) { // Make sure we're on the proper thread. CheckGuiThread(); // It is very important for performance and caching that we delete // the line given instead of rebuilding the counts. Since we are // dealing with indexes, we need to get the count. int count = args.EndLineIndex - args.StartLineIndex + 1; lines.RemoveRange(args.StartLineIndex, count); // Call the base implementation to cascade the events up. base.OnLinesDeleted(sender, args); }
public void RaiseLineInserted(int lineIndex) { var args = new LineRangeEventArgs(lineIndex, lineIndex); base.RaiseLinesInserted(args); }
/// <summary> /// Called when lines are inserted into the underlying buffer. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="LineRangeEventArgs"/> instance containing the event data.</param> protected virtual void OnLinesInserted( object sender, LineRangeEventArgs e) { RaiseLinesInserted(e); }