void GuiApplication::resetGui()
{
+ // Set the language defined by the user.
+ LyX::ref().setRcGuiLanguage();
+
+ // Read menus
+ if (!readUIFile(toqstr(lyxrc.ui_file)))
+ // Gives some error box here.
+ return;
+
+ // init the global menubar on Mac. This must be done after the session
+ // was recovered to know the "last files".
+ if (d->global_menubar_)
+ d->menus_.fillMenuBar(d->global_menubar_, 0, true);
+
QHash<int, GuiView *>::iterator it;
for (it = d->views_.begin(); it != d->views_.end(); ++it)
(*it)->resetDialogs();
// Ensure that a file is read only once (prevents include loops)
static QStringList uifiles;
if (uifiles.contains(name)) {
- LYXERR(Debug::INIT, "UI file '" << name << "' has been read already. "
- << "Is this an include loop?");
- return false;
+ if (!include) {
+ // We are reading again the top uifile so reset the safeguard:
+ uifiles.clear();
+ d->menus_.reset();
+ d->toolbars_.reset();
+ } else {
+ LYXERR(Debug::INIT, "UI file '" << name << "' has been read already. "
+ << "Is this an include loop?");
+ return false;
+ }
}
LYXERR(Debug::INIT, "About to read " << name << "...");
for (; it != d.toolbars_.end(); ++it)
delete it->second;
d.toolbars_.clear();
+ d.layout_ = 0;
// extracts the toolbars from the backend
Toolbars::Infos::iterator cit = guiApp->toolbars().begin();
{
// Make sure that no LFUN uses any LyXView.
theLyXFunc().setLyXView(0);
- // FIXME: the "math panels" toolbar takes an awful lot of time to
- // initialise so we don't do that for the time being.
- //initToolbars();
- guiApp->menus().fillMenuBar(menuBar(), this);
+ saveLayout();
+ menuBar()->clear();
+ constructToolbars();
+ guiApp->menus().fillMenuBar(menuBar(), this, true);
if (d.layout_)
d.layout_->updateContents(true);
// Now update controls with current buffer.
theLyXFunc().setLyXView(this);
+ restoreLayout();
restartCursor();
}
public:
Menus();
~Menus();
+
+ ///
+ void reset();
///
bool searchMenu(FuncRequest const & func,
private:
/// Use the Pimpl idiom to hide the internals.
struct Impl;
- /// The pointer never changes although *d's contents may.
- Impl * const d;
+ ///
+ Impl * d;
};
} // namespace frontend