Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:
Abdelrazak> Dear Jean-Marc, dear all, This change seems natural to me
Abdelrazak> as none of the LyXView features are used.
The expandFoo changes are correct, but I tend to think that the
following is not the best:
- Menu & add(MenuItem const &, LyXView const * view = 0);
+ Menu & add(MenuItem const &, Buffer const * buf = 0);
What about removing the second parameter altogether? What are the
cases when add() can be called with view == 0?
in expandToc2:
tomenu.add(MenuItem(MenuItem::Command, label,
FuncRequest(toc_list[i].action())));
...
if (new_pos == pos + 1) {
tomenu.add(MenuItem(MenuItem::Command,
label,
FuncRequest(toc_list[pos].action())));
...
expandToc2(*item.submenu(),
toc_list, pos, new_pos, depth + 1);
tomenu.add(item);
In expandToc:
for (; ccit != eend; ++ccit) {
docstring const label =
lyx::from_utf8(limit_string_length(ccit->str()));
menu->add(MenuItem(MenuItem::Command,
label,
FuncRequest(ccit->action())));
etc...
I do not think the buffer parameter has any use here.
The only use is there:
Menu & Menu::add(MenuItem const & i, Buffer const * buf)
{
if (!buf) {
items_.push_back(i);
return *this;
}
You can see here that the passed Buffer (or LyXView in the old code) is
just there to differentiate between two methods. Splitting the code is
maybe cleaner. I'll send another patch in a minute.
Abdel.