Skip to content
A scene from Ireland

Neil @ Home

Dreaming dreams

I had a couple of weeks off recently (parent duty for the school holidays) and spent some of it playing with ideas for a document editor. You can find them under the Dreams link on the right.

I observed about myself a particular flaw in my approach to design. I tend to have grand ideas and try to develop them completely. I often run into difficulties in detail and tend to get bogged down in those details. Instead, I should solve a simple version of the problem and only come back to the more grand scheme once I have more experience with the whole system.

Maybe I will learn from this and not allow "Perfect" to be an enemy of "Good"...

Display Windows

In the "what to display - Summary" page I introduced "Display Windows" seemingly out of the blue. I should now develop the idea to make sure that it makes sense.

What to display - Summary

The way my thoughts seem to be going at the moment, where are three general styles of windows which I shall call Navigation windows, Content windows, and Display windows. Their contents are displayed quite differently.

What to display - Information

When deciding what parts of the document to display, and how, a worthy goal is to endeavor to display as much information as possible. (I actually did my undergrad thesis on this question. I never got working code. Maybe now...).

The information content of different parts of the document need to be measuring the context of what the user is currently interested in. i.e. it must be a function of not just the document, but also the cursor.

The common approximation is that content near the cursor contains more information than content distant from the cursor, so content near the cursor is display as much as possible (with allowances for stability).

For plain text, it is hard to do better than this. However for a more structured document, it is tempting to do a lot more.

What to display - Stability

The question for this article is: What should be included in the displayed window for a particular document?

We have a document. We have a current point (cursor) in the document. And we have a display area (window) with certain space characteristics (width, height, DPI) and we want to display part of the document, presumably including the part around the point, making best use of the available space.

There are two issues that can guide us. The first is the need for stability in the display : a small change in the document or point should cause a small change in the display. The other is information content : the display should be as informative as possible.

These two issues can conflict, so they need to be assessed together. However both a quite substantial issues and so developing them in parallel is not practical.

In this article we explore the stability issue assuming a very simple information model. In a later article we might explore information content and then blend the two together.

Describing the layout of a document

I'm still thinking about document formatting, which is a bit of a diversion from the ultimate editor. But I'll get back there.

The language needs to be able to describe what a page looks like, what parts it has, and how content is placed in those parts. It also needs to indicate how overflow content spills onto subsequent pages.

Some of the ideas here are inspired by the Lout typesetting system - a system that I thought held a lot of promise that for some reason it never quite realised (maybe this system will follow in it's footsteps :-( )

Canvas Widget - Take 2

After playing with some code to try to make a canvas widget, I realised I was missing some important ideas. So I will try to write down a new set of thoughts.

One observation I made was that I should make better use of Python's basic types. For example, there is no point creating a "Colour" type when a tuple of (name,r,g,b,alpha,pixel) will do just as well. Similarly the standard python list should be used for a per-window (or per-pane) display list.

Formatting language for document editor

If we want to be able to behave like a formatted document editor, we need a language for defining formating. We could use something like HTML or TeX, but the would be fairly boring and limiting. It is much more fun and educational to define a new one.

Ofcourse, support HTML and TeX as well would be useful but if I wanted to start from scratch, what would it look like...

Canvas Widget

The editor needs to be able to render Text and images on the screen.

We need to store the current 'view' so that Expose callback from X11 can be handled effectively. This is the job of the Canvas.

A Canvas is a rectangle which contains:

  • a background
  • some canvases, each with location, size and depth
  • some text objects, each with a string, a location, a depth, a font, and a colour