-/* This file is part of
-* ======================================================
-*
-* LyX, The Document Processor
-*
-* Copyright 1999-2001 The LyX Team.
-*
-* ======================================================*/
+/**
+ * \file Menubar_pimpl.C
+ * Copyright 1999-2001 The LyX Team.
+ * See the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes, larsbj@lyx.org
+ */
int const mheight = 30;
int const mbheight= 22;
// where to place the menubar?
int const yloc = (mheight - mbheight)/2; //air + bw;
int const mbadd = 20; // menu button add (to width)
int const mheight = 30;
int const mbheight= 22;
// where to place the menubar?
int const yloc = (mheight - mbheight)/2; //air + bw;
int const mbadd = 20; // menu button add (to width)
int const air = 2;
char const * menu_tabstop = "aa";
char const * default_tabstop = "aaaaaaaa";
// We do not want to mix position values in a menu (like the index of
// a submenu) with the action numbers which convey actual information.
// Therefore we offset all the action values by an arbitrary large
int const air = 2;
char const * menu_tabstop = "aa";
char const * default_tabstop = "aaaaaaaa";
// We do not want to mix position values in a menu (like the index of
// a submenu) with the action numbers which convey actual information.
// Therefore we offset all the action values by an arbitrary large
: owner_(view), menubackend_(&mb), current_group_(0)
{
for (MenuBackend::const_iterator menu = menubackend_->begin();
: owner_(view), menubackend_(&mb), current_group_(0)
{
for (MenuBackend::const_iterator menu = menubackend_->begin();
int moffset = 0;
// Create menu frame if there is non yet.
FL_OBJECT * frame = fl_add_frame(FL_UP_FRAME, 0, 0,
form->w, mheight, "");
fl_set_object_resize(frame, FL_RESIZE_ALL);
int moffset = 0;
// Create menu frame if there is non yet.
FL_OBJECT * frame = fl_add_frame(FL_UP_FRAME, 0, 0,
form->w, mheight, "");
fl_set_object_resize(frame, FL_RESIZE_ALL);
label.c_str());
fl_set_object_boxtype(obj, FL_FLAT_BOX);
fl_set_object_color(obj, FL_MCOL, FL_MCOL);
fl_set_object_lsize(obj, MENU_LABEL_SIZE);
label.c_str());
fl_set_object_boxtype(obj, FL_FLAT_BOX);
fl_set_object_color(obj, FL_MCOL, FL_MCOL);
fl_set_object_lsize(obj, MENU_LABEL_SIZE);
void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
vector<int> & smn, Window win)
{
void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
vector<int> & smn, Window win)
{
string const m = floatList[cit->first]->second.name() + "%m";
fl_addtopup(menu, m.c_str(), menu_first_sub);
}
string const m = floatList[cit->first]->second.name() + "%m";
fl_addtopup(menu, m.c_str(), menu_first_sub);
}
-int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
- string const & menu_name,
- vector<int> & smn)
+int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
+ string const & menu_name,
+ vector<int> & smn)
int const menu = get_new_submenu(smn, win);
fl_setpup_softedge(menu, true);
fl_setpup_bw(menu, -1);
int const menu = get_new_submenu(smn, win);
fl_setpup_softedge(menu, true);
fl_setpup_bw(menu, -1);
- lyxerr[Debug::GUI] << "max_width=" << max_width
- << ", widest_label=`" << widest_label
+ lyxerr[Debug::GUI] << "max_width=" << max_width
+ << ", widest_label=`" << widest_label
- if (item.optional()
- && (flag & func_status::Disabled)) {
- lyxerr[Debug::GUI]
- << "Skipping optional item "
- << item.label() << endl;
+ if (item.optional()
+ && (flag.disabled())) {
+ lyxerr[Debug::GUI]
+ << "Skipping optional item "
+ << item.label() << endl;
label += '\t';
while (string_width(label) < max_width + 5);
label += accel.substr(1,accel.find(']') - 1);
}
label += "%x" + tostr(item.action() + action_offset)
+ extra_label;
label += '\t';
while (string_width(label) < max_width + 5);
label += accel.substr(1,accel.find(']') - 1);
}
label += "%x" + tostr(item.action() + action_offset)
+ extra_label;
<< lyxaction.getActionName(item.action())
<< "\", binding \"" << accel
<< lyxaction.getActionName(item.action())
<< "\", binding \"" << accel
add_toc(menu, extra_label, smn, win);
break;
add_toc(menu, extra_label, smn, win);
break;
case MenuItem::ViewFormats:
case MenuItem::UpdateFormats:
case MenuItem::ExportFormats:
case MenuItem::ViewFormats:
case MenuItem::UpdateFormats:
case MenuItem::ExportFormats:
void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
{
ItemInfo * iteminfo = static_cast<ItemInfo *>(ob->u_vdata);
void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
{
ItemInfo * iteminfo = static_cast<ItemInfo *>(ob->u_vdata);
-// lyxerr << "MenuCallback: ItemInfo address=" << iteminfo
-// << "Val=(pimpl_=" << iteminfo->pimpl_
-// << ", item_=" << iteminfo->item_
-// << ", obj_=" << iteminfo->obj_ << ")" <<endl;
+// lyxerr << "MenuCallback: ItemInfo address=" << iteminfo
+// << "Val=(pimpl_=" << iteminfo->pimpl_
+// << ", item_=" << iteminfo->item_
+// << ", obj_=" << iteminfo->obj_ << ")" <<endl;
item->submenu(), submenus);
if (menu != -1) {
// place popup
fl_setpup_position(static_cast<XFormsView *>(view)->getForm()->x + ob->x,
item->submenu(), submenus);
if (menu != -1) {
// place popup
fl_setpup_position(static_cast<XFormsView *>(view)->getForm()->x + ob->x,
if (button == 1) {
// set the pseudo menu-button back
fl_set_object_boxtype(ob, FL_FLAT_BOX);
if (button == 1) {
// set the pseudo menu-button back
fl_set_object_boxtype(ob, FL_FLAT_BOX);
// If the action value is too low, then it is not a
// valid action, but something else.
if (choice >= action_offset + 1) {
// If the action value is too low, then it is not a
// valid action, but something else.
if (choice >= action_offset + 1) {