>>>>> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
>>>>> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: Jean-Marc> Can you try the following patch? The outcome should be the Jean-Marc> same in english, and in french it should work, except that Jean-Marc> the menu entries in the LyX menu will be in english. Jean-Marc> BTW, Abdel, I cannot get the code to load qt translations Jean-Marc> to work here (it reports success, but the file dialog, for Jean-Marc> example, is in english). Does it work for you? Jean-Marc> Try this one instead. It should additionally show correctly Jean-Marc> the menus when a dialog has focus. And I forgot the patch _again_! It really shows that I drank too much and slept too little last night. JMarc
Index: src/frontends/qt4/QLMenubar.C =================================================================== --- src/frontends/qt4/QLMenubar.C (revision 16378) +++ src/frontends/qt4/QLMenubar.C (working copy) @@ -85,7 +85,7 @@ QLMenubar::QLMenubar(LyXView * view, Men menubackend_.expand(menubackend_.getMenubar(), menu, owner_->buffer()); QLPopupMenu * qMenu = new QLPopupMenu(this, *m, true); - owner_->menuBar()->addMenu(qMenu); + menuBar()->addMenu(qMenu); pair<NameMap::iterator, bool> I = name_map_.insert(make_pair(name, qMenu)); if (!I.second) { @@ -97,7 +97,7 @@ QLMenubar::QLMenubar(LyXView * view, Men QObject::connect(qMenu->menuAction(), SIGNAL(triggered()), this, SLOT(update())); */ } - //QObject::connect(owner_->menuBar(), SIGNAL(triggered()), this, SLOT(update())); + //QObject::connect(menuBar(), SIGNAL(triggered()), this, SLOT(update())); } void QLMenubar::openByName(docstring const & name) @@ -179,20 +179,24 @@ void QLMenubar::macxMenuBarInit() build menus on demand, we add the entries to a dummy menu (JMarc) */ - - // this is the name of the menu that contains our special entries - docstring const & specialname = from_ascii("LyX"); - if (menubackend_.hasMenu(specialname)) { - QMenu * qMenu = owner_->menuBar()->addMenu("special"); - //qMenu->setVisible(false); - - menubackend_.specialMenu(specialname); - Menu const & special = menubackend_.getMenu(specialname); - Menu::const_iterator end = special.end(); - for (Menu::const_iterator cit = special.begin(); - cit != end ; ++cit) - qMenu->addAction(new Action(*owner_, cit->label(), cit->func())); - } + + Menu special; + special.add(MenuItem(MenuItem::Command, + qstring_to_ucs4(QMenuBar::tr("About")), + FuncRequest(LFUN_DIALOG_SHOW, "aboutlyx"))); + special.add(MenuItem(MenuItem::Command, + qstring_to_ucs4(QMenuBar::tr("Preferences")), + FuncRequest(LFUN_DIALOG_SHOW, "prefs"))); + special.add(MenuItem(MenuItem::Command, + qstring_to_ucs4(QMenuBar::tr("Quit")), + FuncRequest(LFUN_LYX_QUIT))); + menubackend_.specialMenu(special); + + QMenu * qMenu = menuBar()->addMenu("special"); + Menu::const_iterator end = menubackend_.specialMenu().end(); + for (Menu::const_iterator cit = menubackend_.specialMenu().begin(); + cit != end ; ++cit) + qMenu->addAction(new Action(*owner_, cit->label(), cit->func())); # else qt_mac_set_menubar_merge(false); # endif // MERGE_MAC_MENUS Index: src/MenuBackend.C =================================================================== --- src/MenuBackend.C (revision 16378) +++ src/MenuBackend.C (working copy) @@ -413,10 +413,9 @@ void Menu::checkShortcuts() const } -void MenuBackend::specialMenu(docstring const &name) +void MenuBackend::specialMenu(Menu const & menu) { - if (hasMenu(name)) - specialmenu_ = &getMenu(name); + specialmenu_ = menu; } @@ -890,8 +889,7 @@ void MenuBackend::expand(Menu const & fr break; case MenuItem::Command: - if (!specialmenu_ - || !specialmenu_->hasFunc(cit->func())) + if (!specialmenu_.hasFunc(cit->func())) tomenu.addWithStatusCheck(*cit); } } Index: src/MenuBackend.h =================================================================== --- src/MenuBackend.h (revision 16378) +++ src/MenuBackend.h (working copy) @@ -202,7 +202,7 @@ public: /// typedef MenuList::iterator iterator; /// - MenuBackend() : specialmenu_(0) {} + MenuBackend() {} /// void read(LyXLex &); /// @@ -218,10 +218,13 @@ public: /// bool empty() const { return menulist_.empty(); } /** This defines a menu whose entries list the FuncRequests - will be removed by expand() in other menus. This is used by - the Qt/Mac code + that will be removed by expand() in other menus. This is + used by the Qt/Mac code */ - void specialMenu(docstring const &); + void specialMenu(Menu const &); + /// + Menu const & specialMenu() { return specialmenu_; } + /// Expands some special entries of the menu /** The entries with the following kind are expanded to a sequence of Command MenuItems: Lastfiles, Documents, @@ -251,7 +254,7 @@ private: /// Menu menubar_; /// - Menu * specialmenu_; + Menu specialmenu_; }; /// Index: lib/ui/stdmenus.ui =================================================================== --- lib/ui/stdmenus.ui (revision 16378) +++ lib/ui/stdmenus.ui (working copy) @@ -472,14 +472,4 @@ Menuset Item "About LyX|X" "dialog-show aboutlyx" End -# -# LYX MENU - this menu is only used by LyX/Mac -# - - Menu "LyX" - Item "About LyX" "dialog-show aboutlyx" - Item "Preferences..." "dialog-show prefs" - Item "Quit LyX" "lyx-quit" - End - End