Hello,

I have commited some code for the menu backend (and xforms frontend)
which provides expansion of some of the special menu items, thus
avoiding duplication of code in the frontends. The new method
is Menu::expand(), defined as follows:

        /// Expands some special entries of the menu
        /** The entries with the following kind are exanded to a
            sequence of Command MenuItems: Lastfiles, Documents,
            ViewFormats, ExportFormats, UpdateFormats
        */
        void expand(Menu & tomenu, Buffer *) const;

Using this method in a menu frontend is easy. When creating a menu,
just replace
        Menu md = menubackend_->getMenu(menu_name);
with
        Menu md = Menu();
        menubackend_->getMenu(menu_name).expand(md, owner_->buffer());

Then all the special code for the entries mentionned above can be
removed from the menu frontend, as it will see noraml menu items in
place of the special ones. 

I do not know how this code could be adapted to the case of Toc and
Ref entries, since they contain submenus. Ideas are welcome, of
course.

What remain to be done is using expand in KDE and Gnome frontends, but
I am sure we will get patches for that soon :)

JMarc

Reply via email to