mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
It compiles, ship it. JMarc, can you see why I might be segfaulting
(see code) ? Have I done this right ? Things are still wonky ... and what will I need to do later ... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4773 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6c3456a115
commit
e82c5a64dd
@ -1,3 +1,7 @@
|
|||||||
|
2002-07-24 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* Menubar_pimpl.C: make it compile again
|
||||||
|
|
||||||
2002-07-24 Angus Leeming <leeming@lyx.org>
|
2002-07-24 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* FileDialog_private.C (done): add a false to the arguments passed to
|
* FileDialog_private.C (done): add a false to the arguments passed to
|
||||||
|
@ -72,27 +72,28 @@ Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mbe)
|
|||||||
Menu::const_iterator m = mbe.getMenubar().begin();
|
Menu::const_iterator m = mbe.getMenubar().begin();
|
||||||
Menu::const_iterator end = mbe.getMenubar().end();
|
Menu::const_iterator end = mbe.getMenubar().end();
|
||||||
for (; m != end; ++m) {
|
for (; m != end; ++m) {
|
||||||
makeMenu(owner_->menuBar(), *m);
|
Menu tomenu;
|
||||||
|
Menu const frommenu = menubackend_.getMenu(m->submenuname());
|
||||||
|
menubackend_.expand(frommenu, tomenu, owner_->buffer());
|
||||||
|
makeMenu(owner_->menuBar(), m, tomenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menubar::Pimpl::makeMenu(QMenuData * parent, MenuItem const & menu)
|
void Menubar::Pimpl::makeMenu(QMenuData * parent, MenuItem const * item, Menu const & menu)
|
||||||
{
|
{
|
||||||
// FIXME: does this leak or not ?
|
// FIXME: does this leak or not ?
|
||||||
QPopupMenu * pm = new QPopupMenu();
|
QPopupMenu * pm = new QPopupMenu();
|
||||||
int const parentid = parent->insertItem(getLabel(menu).c_str(), pm);
|
int const parentid = parent->insertItem(getLabel(*item).c_str(), pm);
|
||||||
|
|
||||||
Menu md;
|
Menu::const_iterator m = menu.begin();
|
||||||
menubackend_.getMenu(menu.submenu()).expand(md, 0);
|
Menu::const_iterator end = menu.end();
|
||||||
Menu::const_iterator m = md.begin();
|
|
||||||
Menu::const_iterator end = md.end();
|
|
||||||
for (; m != end; ++m) {
|
for (; m != end; ++m) {
|
||||||
// FIXME: handle the special stuff here
|
// FIXME: handle the special stuff here
|
||||||
if (m->kind() == MenuItem::Separator) {
|
if (m->kind() == MenuItem::Separator) {
|
||||||
pm->insertSeparator();
|
pm->insertSeparator();
|
||||||
} else if (m->kind() == MenuItem::Submenu) {
|
} else if (m->kind() == MenuItem::Submenu) {
|
||||||
makeMenu(pm, *m);
|
makeMenu(pm, m, m->submenu());
|
||||||
} else {
|
} else {
|
||||||
pm->insertItem(getLabel(*m).c_str(), m->action());
|
pm->insertItem(getLabel(*m).c_str(), m->action());
|
||||||
MenuItemInfo const info(pm, m->action(), m);
|
MenuItemInfo const info(pm, m->action(), m);
|
||||||
@ -101,8 +102,8 @@ void Menubar::Pimpl::makeMenu(QMenuData * parent, MenuItem const & menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItemInfo const info(parent, parentid, &menu);
|
MenuItemInfo const info(parent, parentid, item);
|
||||||
items_[menu.label()] = info;
|
items_[item->label()] = info;
|
||||||
updateSubmenu(info);
|
updateSubmenu(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,14 +112,13 @@ void Menubar::Pimpl::makeMenu(QMenuData * parent, MenuItem const & menu)
|
|||||||
// two-level submenus
|
// two-level submenus
|
||||||
void Menubar::Pimpl::updateSubmenu(MenuItemInfo const & i)
|
void Menubar::Pimpl::updateSubmenu(MenuItemInfo const & i)
|
||||||
{
|
{
|
||||||
bool enable = true;
|
#if 0 // SEGFAULTS
|
||||||
#if 0
|
// 7 0x0809d372 in Menu::begin (this=0x0) at MenuBackend.h:138
|
||||||
|
// 8 0x081dcf60 in Menubar::Pimpl::updateSubmenu (this=0x839eaa0, i=@0xbffff010) at Menubar_pimpl.C:116
|
||||||
bool enable = false;
|
bool enable = false;
|
||||||
Menu md;
|
|
||||||
// FIXME FIXME SEGFAULTS
|
Menu::const_iterator m = i.item_->submenu().begin();
|
||||||
menubackend_.getMenu(i.item_->submenu()).expand(md, 0);
|
Menu::const_iterator end = i.item_->submenu().end();
|
||||||
Menu::const_iterator m = md.begin();
|
|
||||||
Menu::const_iterator end = md.end();
|
|
||||||
for (; m != end; ++m) {
|
for (; m != end; ++m) {
|
||||||
if (m->action() > 0) {
|
if (m->action() > 0) {
|
||||||
FuncStatus const status =
|
FuncStatus const status =
|
||||||
@ -127,7 +127,9 @@ void Menubar::Pimpl::updateSubmenu(MenuItemInfo const & i)
|
|||||||
enable = true;
|
enable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#else
|
||||||
|
bool enable = true;
|
||||||
|
#endif
|
||||||
i.parent_->setItemEnabled(i.id_, enable);
|
i.parent_->setItemEnabled(i.id_, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/// create a menu
|
/// create a menu
|
||||||
void makeMenu(QMenuData * parent, MenuItem const & menu);
|
void makeMenu(QMenuData * parent, MenuItem const * item, Menu const & menu);
|
||||||
|
|
||||||
/// special handling updating a submenu label
|
/// special handling updating a submenu label
|
||||||
void updateSubmenu(MenuItemInfo const & i);
|
void updateSubmenu(MenuItemInfo const & i);
|
||||||
|
Loading…
Reference in New Issue
Block a user