Area model

Vladimir Prus ghost at cs.msu.su
Sat May 3 13:39:13 UTC 2008


Alexander,
since you're away on IRC for a bit, this gives me a chance to describe the
area model in a coherent way, as below:

1. I think we've agreed that it's desirable to have a list of "area types"
and to be able to switch any given main window between those "area types".
Here, "area type" is just string identifier user sees.

2. It's also desirable to save the state of area -- like the set of toolviews,
position of toolviews, etc. This need to be done per-main window, so that
"code" area of one window is allowed to be different from "code" area
of another window.

3. Is it desirable to be able to reset an area of given type in a given
main window to a default state.

The current implementation achieves those goals by:

1. Making a controller keep a list of defaults areas. Those areas are not
in any main window, so they are never modified as result of user actions.
They are directly constructed by kdevelop core, they are not clones
of anything.  Presently, the 'areas()' method of Sublime::Controller returns
them. In fact, I suspect the areas() method was meant to do this all the
time, as it has comment about excluding clones, but previously, it would
return all areas ever created.

2. Making a controller keep a list of Area instances for each (mainwindow,area
type) pair. The "code" area in each mainwindow is the clone of "code" default area.

3. We presently create area clones per each main window when we create a main
window. An alternative approach would be to create a clone only when we try to
show a specific area type in a main window. However, I think that knowing that
each main window has its Area instance for each area type simplifies the code.
For example, most of the time, during restoring areas we'd need per-window area
instances anyway.
Of course, we can introduce a method demand_area_type(MainWindow*, QString) that
clones the default area of the necessary type, but I don't see what that will
buy us.

So, essentially, the changes I've did were:

1. Making Controller::area() actually return only one area for a given type, without
any clones.
2. Making sure those areas are not in any mainwindow.

Does this make sense?

- Volodya






More information about the KDevelop-devel mailing list