From 8c8ff137dad6e998f60ac60e328a232a6c71c6c1 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 27 Feb 2008 12:30:41 +0000 Subject: [PATCH] Get rid of 'quitting' global variable. It is not needed anymore because all windows are closed in order now and the frontend/core is properly separated. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23280 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyX.cpp | 6 ------ src/LyX.h | 1 - src/LyXFunc.cpp | 4 ++-- src/frontends/qt4/GuiView.cpp | 22 ---------------------- src/insets/Inset.cpp | 5 +---- 5 files changed, 3 insertions(+), 35 deletions(-) diff --git a/src/LyX.cpp b/src/LyX.cpp index 40d76173a2..9a60901d84 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -83,8 +83,6 @@ namespace os = support::os; bool use_gui = true; -bool quitting; // flag, that we are quitting the program - namespace { // Filled with the command line arguments "foo" of "-sysdir foo" or @@ -458,10 +456,6 @@ void LyX::prepareExit() cap::clearCutStack(); cap::clearSelection(); - // Set a flag that we do quitting from the program, - // so no refreshes are necessary. - quitting = true; - // close buffers first pimpl_->buffer_list_.closeAll(); diff --git a/src/LyX.h b/src/LyX.h index 982301a4e1..0d8616eff9 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -38,7 +38,6 @@ class KeyMap; class CmdDef; extern bool use_gui; -extern bool quitting; namespace frontend { class Application; diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 986d7de426..717d686f1c 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -206,7 +206,7 @@ void LyXFunc::initKeySequences(KeyMap * kb) void LyXFunc::setLyXView(LyXView * lv) { - if (!quitting && lyx_view_ && lyx_view_->view() && lyx_view_ != lv) + if (lyx_view_ && lyx_view_->view() && lyx_view_ != lv) // save current selection to the selection buffer to allow // middle-button paste in another window cap::saveSelection(lyx_view_->view()->cursor()); @@ -1742,7 +1742,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) theSelection().haveSelection(view()->cursor().selection()); } } - if (!quitting && lyx_view_) { + if (lyx_view_) { // Some messages may already be translated, so we cannot use _() sendDispatchMessage(translateIfPossible(getMessage()), cmd); } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index d0ed739181..f003951cf3 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -433,20 +433,7 @@ void GuiView::closeEvent(QCloseEvent * close_event) } guiApp->unregisterView(id_); - if (guiApp->viewCount() > 0) { - // Just close the window and do nothing else if this is not the - // last window. - close_event->accept(); - return; - } - - quitting = true; - - // this is the place where we leave the frontend. - // it is the only point at which we start quitting. close_event->accept(); - // quit the event loop - qApp->quit(); } @@ -1783,8 +1770,6 @@ bool GuiView::dispatch(FuncRequest const & cmd) break; case LFUN_DIALOG_HIDE: { - if (quitting) - break; guiApp->hideDialogs(to_utf8(cmd.argument()), 0); break; } @@ -2094,13 +2079,6 @@ bool GuiView::isDialogVisible(string const & name) const void GuiView::hideDialog(string const & name, Inset * inset) { - // Don't send the signal if we are quitting, because on MSVC it is - // destructed before the cut stack in CutAndPaste.cpp, and this method - // is called from some inset destructor if the cut stack is not empty - // on exit. - if (quitting) - return; - map::const_iterator it = d.dialogs_.find(name); if (it == d.dialogs_.end()) return; diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index ed94df8ae3..3bfd0a4aed 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -25,7 +25,6 @@ #include "DispatchResult.h" #include "FuncRequest.h" #include "FuncStatus.h" -#include "LyX.h" // quitting #include "MetricsInfo.h" #include "Text.h" #include "TextClass.h" @@ -393,9 +392,7 @@ void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const Buffer const * Inset::updateFrontend() const { - if (quitting) - return 0; - return theApp()->updateInset(this); + return theApp()? theApp()->updateInset(this) : 0; } } // namespace lyx -- 2.39.5