I've been working quite a bit on something I can only describe as a "threaded canvas" for some time now. In a moment I'll describe what I have, but since I'm really open to new ideas, existing solutions or a completely fresh start, I'll formulate the problem.
The canvas is intended to display genetic information (although the specific purpose is somewhat irrelevant). As a conventional text editor, this genetic code is drawn to a canvas, upon which the user can interact with it by typing, selecting, etc. The code is then further decorated with various non-text features such as shapes, lines and colors.
The primary issue here is that significant calculations need to be made prior to displaying certain information.
Consider the following mock-up:
Sample of canvas http://img23.imageshack.us/img23/9931/canvasgv.png
As you can see, the genetic code is monospaced, but the enzyme cuts (shown above the genetic code) are not. Computing where enzymes cut is tedious, as can be displaying features (above, the blue arrow) as there may be very many on-screen. The three-letter codes indicate translations of three blocks of genetic code; although this is performed quickly, typing a single letter into the sequence makes them all shift by one--requiring a recalculation.
Preferably, to speed things up, each of these parts could occur in a separate thread, coming together in the end to compose the final image.
Summarizing: individual parts of the display are computationally difficult, though it is of course desirable that the editor is as responsive as possible.
My present implementation involves performing all draw events in individual threads. By typing, resizing or making selections, a large number of threads may be created, but only the most recent one proceeds to update the display. This guarantees that updating the display takes no longer than one iteration, but doesn't provide snappy feedback of the UI.
I've looked into making modifications to existing editors such as StyledText, but anything more than some boldface and colors makes it significantly slow.
Any suggestions?