]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
Streamlining CollapseStatus stuff
[lyx.git] / src / LyX.cpp
index 4d8f10eafbef16e142835423185642c5822dc3e1..e93cfe64941f027ef76d0d6934ed9d5c8c28c8ab 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "frontends/alert.h"
 #include "frontends/Application.h"
+#include "frontends/Dialogs.h"
 #include "frontends/Gui.h"
 #include "frontends/LyXView.h"
 
 #include <string>
 #include <vector>
 
+using std::endl;
+using std::for_each;
+using std::map;
+using std::make_pair;
+using std::string;
+using std::vector;
+
+#ifndef CXX_GLOBAL_CSTD
+using std::exit;
+using std::signal;
+using std::system;
+#endif
+
+namespace fs = boost::filesystem;
 
 namespace lyx {
 
@@ -88,23 +103,11 @@ using support::package;
 using support::prependEnvPath;
 using support::rtrim;
 using support::Systemcall;
+using frontend::LyXView;
 
 namespace Alert = frontend::Alert;
 namespace os = support::os;
-namespace fs = boost::filesystem;
 
-using std::endl;
-using std::for_each;
-using std::map;
-using std::make_pair;
-using std::string;
-using std::vector;
-
-#ifndef CXX_GLOBAL_CSTD
-using std::exit;
-using std::signal;
-using std::system;
-#endif
 
 
 /// are we using the GUI at all?
@@ -363,7 +366,7 @@ void LyX::setGuiLanguage(std::string const & language)
 
 Buffer const * const LyX::updateInset(Inset const * inset) const
 {
-       if (!inset)
+       if (quitting || !inset)
                return 0;
 
        Buffer const * buffer_ptr = 0;
@@ -380,6 +383,20 @@ Buffer const * const LyX::updateInset(Inset const * inset) const
 }
 
 
+void LyX::hideDialogs(std::string const & name, Inset * inset) const
+{
+       if (quitting || !use_gui)
+               return;
+
+       vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
+       vector<int>::const_iterator it = view_ids.begin();
+       vector<int>::const_iterator const end = view_ids.end();
+       for (; it != end; ++it)
+               pimpl_->application_->gui().view(*it).getDialogs().
+                       hide(name, inset);
+}
+
+
 int LyX::exec(int & argc, char * argv[])
 {
        // Here we need to parse the command line. At least
@@ -398,6 +415,10 @@ int LyX::exec(int & argc, char * argv[])
                }
        }
 
+       // Reinit the messages machinery in case package() knows
+       // something interesting about the locale directory.
+       Messages::init();
+
        if (!use_gui) {
                // FIXME: create a ConsoleApplication
                int exit_status = init(argc, argv);
@@ -613,7 +634,7 @@ void LyX::restoreGuiSession()
        if (!pimpl_->files_to_load_.empty()) {
                for_each(pimpl_->files_to_load_.begin(),
                        pimpl_->files_to_load_.end(),
-                       bind(&LyXView::loadLyXFile, view, _1, true));
+                       bind(&LyXView::loadLyXFile, view, _1, true, false, false));
                // clear this list to save a few bytes of RAM
                pimpl_->files_to_load_.clear();
                pimpl_->session_->lastOpened().clear();
@@ -628,7 +649,7 @@ void LyX::restoreGuiSession()
        // last session, and should be already there (regular files), or should
        // not be added at all (help files).
        for_each(lastopened.begin(), lastopened.end(),
-               bind(&LyXView::loadLyXFile, view, _1, false));
+               bind(&LyXView::loadLyXFile, view, _1, false, false, false));
 
        // clear this list to save a few bytes of RAM
        pimpl_->session_->lastOpened().clear();