]> git.lyx.org Git - features.git/commitdiff
simplify window creation.
authorAbdelrazak Younes <younes@lyx.org>
Fri, 23 Nov 2007 09:56:33 +0000 (09:56 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 23 Nov 2007 09:56:33 +0000 (09:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21735 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyX.cpp
src/LyXFunc.cpp
src/frontends/Application.h
src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiApplication.h

index 456b47ebf698493d9a55e9fd8373d84751f4bd83..695fccc6242736ac95951acada2f053bf8e7e57a 100644 (file)
@@ -48,7 +48,6 @@
 
 #include "frontends/alert.h"
 #include "frontends/Application.h"
-#include "frontends/LyXView.h"
 
 #include "support/environment.h"
 #include "support/filetools.h"
@@ -99,7 +98,6 @@ using support::package;
 using support::prependEnvPath;
 using support::rtrim;
 using support::Systemcall;
-using frontend::LyXView;
 
 namespace Alert = frontend::Alert;
 namespace os = support::os;
@@ -627,7 +625,8 @@ void LyX::execBatchCommands()
 
 void LyX::restoreGuiSession()
 {
-       LyXView * view = newLyXView();
+       // create the main window
+       pimpl_->application_->createView(geometryArg);
 
        // if there is no valid class list, do not load any file. 
        if (textclasslist.empty())
@@ -663,24 +662,6 @@ void LyX::restoreGuiSession()
                        continue;
                updateLabels(*buf);
        }
-
-       // FIXME: Switch to the last loaded Buffer. This must not be the first one
-       // because the Buffer won't be connected in this case. The correct solution
-       // would be to avoid the manual connection of the current Buffer in LyXView.
-       if (!pimpl_->buffer_list_.empty())
-               view->setBuffer(pimpl_->buffer_list_.last());
-}
-
-
-LyXView * LyX::newLyXView()
-{
-       if (!lyx::use_gui)
-               return 0;
-
-       // create the main window
-       LyXView * view = &pimpl_->application_->createView(geometryArg);
-
-       return view;
 }
 
 /*
index 704c970ed2af93f1f4b1e9dd4c11f230a4acf6c3..253dd67b86882d9925f5d2a96d319a157e7562a3 100644 (file)
@@ -1854,7 +1854,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                }
 
                case LFUN_WINDOW_NEW:
-                       LyX::ref().newLyXView();
+                       theApp()->createView();
                        break;
 
                case LFUN_WINDOW_CLOSE:
index f85f196e8ec156b2d144c1a2c9db6cc2648296b0..89c999318c5699b432aa3a8e3fba6ccdf6dbab85 100644 (file)
@@ -207,7 +207,7 @@ public:
 
        /// Create the main window with given geometry settings.
        /// \param geometry_arg: only for Windows platform.
-       virtual LyXView & createView(std::string const & geometry_arg) = 0;
+       virtual void createView(std::string const & geometry_arg = std::string()) = 0;
 };
 
 } // namespace frontend
index e646929f76c60e5243754bb79e65be6303b9cad3..1941c3bae04ae75739563b2bc232ead5264a92f7 100644 (file)
@@ -230,7 +230,7 @@ static void updateIds(map<int, GuiView *> const & stdmap, vector<int> & ids)
 }
 
 
-LyXView & GuiApplication::createView(string const & geometry_arg)
+void GuiApplication::createView(string const & geometry_arg)
 {
        updateIds(views_, view_ids_);
        int id = 0;
@@ -259,8 +259,6 @@ LyXView & GuiApplication::createView(string const & geometry_arg)
        view->setFocus();
 
        setCurrentView(*view);
-
-       return *view;
 }
 
 
index 435af2d813687b2233d6a2def8c6d27cd9dff259..a97878796af7b9c88d5976f6c7024a5bb5838ae0 100644 (file)
@@ -68,7 +68,7 @@ public:
        virtual void updateColor(ColorCode col);
        virtual void registerSocketCallback(int fd, SocketCallback func);
        void unregisterSocketCallback(int fd);
-       LyXView & createView(std::string const & geometry_arg);
+       void createView(std::string const & geometry_arg = std::string());
        //@}
 
        /// Methods inherited from \c QApplication class