/// <summary> /// Sets up the basic unit tests with set strings and controls. /// </summary> private void SetupTests( out EditorViewController controller, out Caret caret, out LineBuffer lineBuffer) { // Set up Gtk so we can create the view. Application.Init(); // Set up an editor without a cached renderer and a memory buffer // we can easily verify. var view = new EditorView(); caret = view.Caret; lineBuffer = new MemoryLineBuffer(); controller = view.Controller; var renderer = new LineBufferRenderer(view, lineBuffer); view.SetRenderer(renderer); // Create three lines of text. TextActions.InsertText(controller, DefaultLine); TextActions.InsertParagraph(controller); TextActions.InsertText(controller, DefaultLine); TextActions.InsertParagraph(controller); TextActions.InsertText(controller, DefaultLine); }
/// <summary> /// Sets the line buffer in the editor view. /// </summary> /// <param name="value">The value.</param> public void SetLineBuffer(LineBuffer value) { // If it is null, then clear out the buffer but don't create a // text renderer if we don't have to. if (value == null) { if (Renderer != null) { Renderer.ClearLineBuffer(); } // Handle the update to the view. HandleChangedLineBuffer(); return; } // If we don't have a text renderer, use a sane default which works // in most cases. if (Renderer == null) { // We don't have a renderer, so create one. var lineBufferRenderer = new LineBufferRenderer(this); SetRenderer(new CachedTextRenderer(this, lineBufferRenderer)); } // Now set the line buffer and perform the preparation operations. Renderer.SetLineBuffer(value); HandleChangedLineBuffer(); }
public void Setup() { // Set up an editor without a cached renderer and a memory buffer // we can easily verify. editor = new EditorView(); controller = editor.Controller; buffer = new MemoryLineBuffer(); renderer = new LineBufferRenderer(editor, buffer); editor.SetRenderer(renderer); }