>>>>> "John" == John Levon <[EMAIL PROTECTED]> writes:

John> JMarc I'm totally confused by your last changes, and I don't
John> know how to fix Qt for them.

John> Can you help a poor soul

It is not very complicated actually. What has changed

- Menu::expand is now MenuBackend::expand

- MenuItem::submenu() has been renamed to MenuItem::submenuname()

- MenuItem::submenu() now returns a Menu const & object, but which
  only makes sense _after_ expand has been called.

The main difference now is that expand only has to get called _once_
and that it physically (and recursively) builds the whole menu tree. 

Basically, the code for populating one item of the menubar goes like
this:

        Menu tomenu;
        Menu const frommenu = menubackend_->getMenu(item->submenuname());
        menubackend_->expand(frommenu, tomenu, view->buffer());
        create_submenu(tomenu);

create_submenu iterates over a menu object, and when it encounters 
a submenu, it does something like
        menu = create_submenu(item.submenu());
and then whever is needed to insert the summenu in the current menu.

Is that clearer now? I plan to remove toc code from menu frontend this
evening, so that all the menuitem kinds you should have to worry about
are Command, Submenu and Separator. Will that be simple enough?

Then of course will come the problems of when we want the TOCs to be
updated. But this is a separate problem, to be solved at MenuBackend
level. I'll try to do some profiling/optimization of the code, to see
if we _really_ need to be clever there.

JMarc

Reply via email to