]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_main.C
LFUN_UNICODE_INSERT - unicode-insert
[lyx.git] / src / lyx_main.C
index 874f10d8c024190f4e455627d17feeb33230cbfd..6d0949458bda0fe2fc60eb36f2cd37975d9a98e7 100644 (file)
@@ -333,9 +333,10 @@ int LyX::priv_exec(int & argc, char * argv[])
                // Start the real execution loop.
 
                // FIXME
-               /* Create a CoreApplication class that will provide the main event loop and 
-                * the socket callback registering. With Qt4, only QtCore library would be needed.
-                * When this done, a server_mode could be created and the following two
+               /* Create a CoreApplication class that will provide the main event loop
+                * and the socket callback registering. With Qt4, only QtCore
+                * library would be needed.
+                * When this is done, a server_mode could be created and the following two
                 * line would be moved out from here.
                 */
                pimpl_->lyx_server_.reset(new LyXServer(&pimpl_->lyxfunc_, lyxrc.lyxpipes));
@@ -491,6 +492,28 @@ int LyX::execBatchCommands(int & argc, char * argv[],
 
 
 void LyX::restoreGuiSession(vector<string> const & files)
+{
+       LyXView * view = newLyXView();
+
+       // load files
+       for_each(files.begin(), files.end(),
+               bind(&LyXView::loadLyXFile, view, _1, true));
+
+       // if a file is specified, I assume that user wants to edit *that* file
+       if (files.empty() && lyxrc.load_session) {
+               vector<string> const & lastopened = pimpl_->session_->lastOpenedFiles();
+               // do not add to the lastfile list since these files are restored from
+               // last seesion, 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));
+       }
+       // clear this list to save a few bytes of RAM
+       pimpl_->session_->clearLastOpenedFiles();
+}
+
+
+LyXView * LyX::newLyXView()
 {
        // determine windows size and position, from lyxrc and/or session
        // initial geometry
@@ -513,6 +536,7 @@ void LyX::restoreGuiSession(vector<string> const & files)
                if (session().loadSessionInfo("WindowIsMaximized") == "yes")
                        maximize = true;
        }
+
        // if user wants to restore window position
        int posx = -1;
        int posy = -1;
@@ -533,24 +557,9 @@ void LyX::restoreGuiSession(vector<string> const & files)
        LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximize);
        ref().addLyXView(view);
 
-       // load files
-       for_each(files.begin(), files.end(),
-               bind(&LyXView::loadLyXFile, view, _1, true));
-
-       // if a file is specified, I assume that user wants to edit *that* file
-       if (files.empty() && lyxrc.load_session) {
-               vector<string> const & lastopened = pimpl_->session_->lastOpenedFiles();
-               // do not add to the lastfile list since these files are restored from
-               // last seesion, 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));
-       }
-       // clear this list to save a few bytes of RAM
-       pimpl_->session_->clearLastOpenedFiles();
+       return view;
 }
 
-
 /*
 Signals and Windows
 ===================