Introducing Application::resetGui() that will reset all dialogs in all lyx windows (including toolbars and menubars).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21689 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-21 15:12:47 +00:00
parent 0f56650139
commit 8460c9a072
7 changed files with 34 additions and 1 deletions

View File

@ -1878,6 +1878,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
actOnUpdatedPrefs(lyxrc_orig, lyxrc);
theApp()->resetGui();
/// We force the redraw in any case because there might be
/// some screen font changes.
/// FIXME: only the current view will be updated. the Gui

View File

@ -151,6 +151,9 @@ public:
///
virtual ~Application() {}
///
virtual void resetGui() = 0;
///
virtual bool closeAllViews() = 0;
///

View File

@ -213,6 +213,14 @@ GuiApplication::~GuiApplication()
}
void GuiApplication::resetGui()
{
map<int, GuiView *>::iterator it;
for (it = views_.begin(); it != views_.end(); ++it)
it->second->resetDialogs();
}
static void updateIds(map<int, GuiView *> const & stdmap, vector<int> & ids)
{
ids.clear();

View File

@ -56,6 +56,7 @@ public:
/// Method inherited from \c Application class
//@{
virtual void resetGui();
virtual Clipboard & clipboard();
virtual Selection & selection();
virtual FontLoader & fontLoader() { return font_loader_; }

View File

@ -112,6 +112,11 @@ void GuiToolbars::initFlags(ToolbarInfo & tbinfo)
void GuiToolbars::init()
{
ToolbarsMap::const_iterator it = toolbars_.begin();
for (; it != toolbars_.end(); ++it)
delete it->second;
toolbars_.clear();
// extracts the toolbars from the backend
ToolbarBackend::Toolbars::iterator cit = toolbarbackend.begin();
ToolbarBackend::Toolbars::iterator end = toolbarbackend.end();

View File

@ -1213,6 +1213,18 @@ bool isValidName(string const & name)
} // namespace anon
void GuiView::resetDialogs()
{
// Make sure that no LFUN uses any LyXView.
theLyXFunc().setLyXView(0);
delete d.menubar_;
d.toolbars_->init();
d.menubar_ = new GuiMenubar(this, menubackend);
if (d.layout_)
d.layout_->updateContents(true);
}
Dialog * GuiView::find_or_build(string const & name)
{
if (!isValidName(name))

View File

@ -58,7 +58,6 @@ public:
~GuiView();
///
///
int id() const { return id_; }
void close();
@ -181,6 +180,9 @@ public:
/// dialogs for this view
///
///
void resetDialogs();
/** Check the status of all visible dialogs and disable or reenable
* them as appropriate.
*