From 32fac28acfa503563365f0a7e3d585d288a8a0f8 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 2 May 2008 20:58:25 +0000 Subject: [PATCH] Simplify dialogs updating. * GuiView::updateDialogs(): merge with GuiView::checkStatus() * LyXFunc::processKeySym(): remove call to GuiView::restartCursor(), this has already been called in the call to dispatch() at the end of the methof. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24588 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyXFunc.cpp | 3 --- src/frontends/qt4/GuiView.cpp | 38 ++++--------------------------- src/frontends/qt4/GuiView.h | 13 +++++------ src/frontends/qt4/GuiWorkArea.cpp | 3 +-- 4 files changed, 11 insertions(+), 46 deletions(-) diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index a2689cee34..c5d376686a 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -377,9 +377,6 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) if (!lyx_view_) return; } - - if (lyx_view_) - lyx_view_->restartCursor(); } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 398d80475f..46b0a83f9d 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -433,7 +433,7 @@ void GuiView::closeEvent(QCloseEvent * close_event) // Save toolbars configuration if (isFullScreen()) { d.toolbars_->toggleFullScreen(!isFullScreen()); - updateToolbars(); + updateDialogs(); } // Make sure the timer time out will not trigger a statusbar update. @@ -849,9 +849,6 @@ void GuiView::updateToolbars() d.toolbars_->update(math, table, review, mathmacrotemplate); } else d.toolbars_->update(false, false, false, false); - - // update read-only status of open dialogs. - checkStatus(); } @@ -1993,9 +1990,7 @@ void GuiView::restartCursor() d.current_work_area_->startBlinkingCursor(); // Take this occasion to update the other GUI elements. - updateLayoutList(); - updateToolbars(); - updateStatusBar(); + updateDialogs(); } @@ -2160,19 +2155,8 @@ void GuiView::updateDialogs() for(; it != end; ++it) { Dialog * dialog = it->second.get(); - if (!dialog->isVisibleView()) - continue; - if (dialog->isBufferDependent()) { - if (buffer()) - dialog->updateView(); - else - dialog->enableView(false); - } else { - // A bit clunky, but the dialog will request - // that the kernel provides it with the necessary - // data. - dialog->updateDialog(); - } + if (dialog && dialog->isVisibleView()) + dialog->checkStatus(); } updateToolbars(); updateLayoutList(); @@ -2180,20 +2164,6 @@ void GuiView::updateDialogs() } -void GuiView::checkStatus() -{ - map::const_iterator it = d.dialogs_.begin(); - map::const_iterator end = d.dialogs_.end(); - - for(; it != end; ++it) { - Dialog * const dialog = it->second.get(); - if (dialog && dialog->isVisibleView()) - dialog->checkStatus(); - } -} - - - // will be replaced by a proper factory... Dialog * createGuiAbout(GuiView & lv); Dialog * createGuiBibitem(GuiView & lv); diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index ad95e4d677..d3e041f3d5 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -198,19 +198,18 @@ public: /// void resetDialogs(); - /** Check the status of all visible dialogs and disable or reenable + /// Hide all visible dialogs + void hideAll() const; + + /// Update all visible dialogs. + /** + * Check the status of all visible dialogs and disable or reenable * them as appropriate. * * Disabling is needed for example when a dialog is open and the * cursor moves to a position where the corresponding inset is not * allowed. */ - void checkStatus(); - - /// Hide all visible dialogs - void hideAll() const; - - // Update all visible dialogs. void updateDialogs(); /** \param name == "bibtex", "citation" etc; an identifier used to diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 1feef594d9..c116bbb599 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -452,8 +452,7 @@ void GuiWorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod) // Skip these when selecting if (cmd.action != LFUN_MOUSE_MOTION) { completer_->updateVisibility(false, false); - lyx_view_->updateLayoutList(); - lyx_view_->updateToolbars(); + lyx_view_->updateDialogs(); } // GUI tweaks except with mouse motion with no button pressed. -- 2.39.2