>>>>> "Abdel" == Abdel  <[EMAIL PROTECTED]> writes:

Let's reply once again to the same message. I think I forgot some
answers.


Abdel> OK, thanks. My main problem is that while a MenuItem is of
Abdel> Submenu kind, sometimes (depends on the document you load and
Abdel> the time of day) its associated submenu is empty. This happens
Abdel> only for the Navigate menu, others works fine. 

When you use the navigate menu, the code creates new submenus. It is
thus not possible to give them meaningful names. My question is: why
do you need menus to have names? You can access the submenu itself
using submenu().

Of course, this is messy and this is why I should have separated the
classes representing abstract menus and instantiated ones.

Abdel> It seems that the submenu is filled in after you ask for it. So
Abdel> IMHO, there is a chicken and eggs problem here. Ex: in this
Abdel> code snippet I had to put a continue here in order to avoid
Abdel> potential crash:

I do not not understand why there is a chicken and egg problem.

The program flow is supposed to be:

1/ a menu from the menubar is invoked

2/ you get the name of this menu, get the menu from menubackend and
expand it. Now you have a real tree with all the submenus and there is
no need to call getMenu or expandMenu.

3/ you use this information to create recursively QLPopupMenu:s.

Is that what you do? If it is not, why?

Abdel> Second, I really don't understand why we have to expand the
Abdel> menu we are looking for into a new local menu:

What do you call a new local menu?

Abdel> In my opinion we should just be able to use getMenu() without
Abdel> having to expand it. In this case MenuVackend member menulist_
Abdel> should of course be mutable (because getMenu is a const
Abdel> function). So the MenuBackend should make sure that the menu
Abdel> you ask for is always up to date.

Calling expandMenu _once_ is not so difficult, is it?

Abdel> Another problem that I have is with the MenuItem::func()
Abdel> member. I store it this way in a QLAction which is a lyx
Abdel> tailored QAction: QLAction * action = new
Abdel> QLAction(*(owner_->view()), label, m->func()); So the
Abdel> FuncRequest is stored in the QLAction and is called when you
Abdel> click on the corresponding MenuItem. 

Looks reasonable.

Abdel> The problem is that this make lyx crashing for some MenuItem
Abdel> randomly (not all). It seems that this FuncRequest is not
Abdel> constant for a given MenuItem... weird.

I can't tell without more details.

Abdel> I realize now that my explanation is a bit abstract so I attach
Abdel> my ports of QView, QLMenubar and QLPopupmenu to this mail
Abdel> (QLAction is defined in QView.[hC]

I tried to make a diff wrt HEAD, but there are too many changes to
allow me to understand what is important and what is not...

JMarc

Reply via email to