/**
- * \file Menubar_pimpl.C
- * Copyright 1999-2001 The LyX Team.
- * See the file COPYING.
+ * \file xforms/Menubar_pimpl.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Lars Gullik Bjønnes, larsbj@lyx.org
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
}
+Menubar::Pimpl::~Pimpl()
+{}
+
+
void Menubar::Pimpl::makeMenubar(Menu const & menu)
{
FL_FORM * form = owner_->getForm();
if (i->kind() == MenuItem::Separator)
*last = "%l";
else if (!i->optional() ||
- !(view->getLyXFunc()->getStatus(i->action()).disabled()))
+ !(view->getLyXFunc().getStatus(i->action()).disabled()))
last = it;
it = extra_labels.begin();
size_type count = 0;
+ all_disabled = true;
int curmenuid = menuid;
for (Menu::const_iterator i = menu.begin(); i != end; ++i, ++it) {
MenuItem const & item = (*i);
string & extra_label = *it;
++count;
- if (count > max_number_of_items) {
+ // add a More... submenu if the menu is too long (but
+ // not just for one extra entry!)
+ if (count > max_number_of_items && (i+1) != end) {
int tmpmenuid = get_new_submenu(smn, win);
lyxerr[Debug::GUI] << "Too many items, creating "
<< "new menu " << tmpmenuid << endl;
switch (item.kind()) {
case MenuItem::Command: {
FuncStatus const flag =
- view->getLyXFunc()->getStatus(item.action());
+ view->getLyXFunc().getStatus(item.action());
// handle optional entries.
if (item.optional()
&& (flag.disabled())) {
}
case MenuItem::Submenu: {
+ bool sub_all_disabled;
int submenuid = create_submenu(win, view,
*item.submenu(), smn,
- all_disabled);
+ sub_all_disabled);
+ all_disabled &= sub_all_disabled;
if (submenuid == -1)
return -1;
string label = fixlabel(item.label());
label += extra_label + "%m";
- if (all_disabled)
+ if (sub_all_disabled)
label += "%i";
string shortcut = item.shortcut();
if (!shortcut.empty()) {
// If the action value is too low, then it is not a
// valid action, but something else.
if (choice >= action_offset + 1) {
- view->getLyXFunc()->dispatch(choice - action_offset, true);
+ view->getLyXFunc().dispatch(choice - action_offset, true);
} else {
lyxerr[Debug::GUI]
<< "MenuCallback: ignoring bogus action "
fl_set_tabstop(default_tabstop);
}
+
+
+Menubar::Pimpl::ItemInfo::ItemInfo
+ (Menubar::Pimpl * p, MenuItem const * i, FL_OBJECT * o)
+ : pimpl_(p), obj_(o)
+{
+ item_.reset(i);
+}
+
+
+Menubar::Pimpl::ItemInfo::~ItemInfo()
+{}