]> git.lyx.org Git - features.git/commitdiff
Transfer createView() from Application to GuiApplication and get rid of LyXView:...
authorAbdelrazak Younes <younes@lyx.org>
Tue, 13 Nov 2007 15:29:15 +0000 (15:29 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 13 Nov 2007 15:29:15 +0000 (15:29 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21585 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyX.cpp
src/frontends/Application.cpp
src/frontends/Application.h
src/frontends/Gui.h
src/frontends/LyXView.h
src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiApplication.h
src/frontends/qt4/GuiImplementation.cpp
src/frontends/qt4/GuiImplementation.h
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h

index 21f351bb4c3b153c3dbc6041a17563a36d175323..1da1328ce08c109c079132332b429c074dbbbeb8 100644 (file)
@@ -711,13 +711,16 @@ LyXView * LyX::newLyXView()
        if (!lyx::use_gui)
                return 0;
 
+       // FIXME: transfer all this geometry stuff to the frontend.
+
        // determine windows size and position, from lyxrc and/or session
        // initial geometry
        unsigned int width = 690;
        unsigned int height = 510;
        // default icon size, will be overwritten by  stored session value
        unsigned int iconSizeXY = 0;
-       int maximized = LyXView::NotMaximized;
+       // FIXME: 0 means GuiView::NotMaximized by default!
+       int maximized = 0;
        // first try lyxrc
        if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
                width = lyxrc.geometry_width;
@@ -758,7 +761,8 @@ LyXView * LyX::newLyXView()
        }
 
        // create the main window
-       LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximized, iconSizeXY, geometryArg);
+       LyXView * view = &pimpl_->application_->createView(width, height,
+               posx, posy, maximized, iconSizeXY, geometryArg);
 
        return view;
 }
index fdffa801daa5f948684f815510a71239f1aa536f..f942aed08541bbd0b8af37bc353be475018cf38e 100644 (file)
@@ -40,28 +40,6 @@ Application::Application(int &, char **)
 }
 
 
-LyXView & Application::createView(unsigned int width,
-                                 unsigned int height,
-                                 int posx, int posy,
-                                 int maximized,
-                                 unsigned int iconSizeXY,
-                                 const std::string & geometryArg)
-{
-       LyXView & view = gui().createRegisteredView();
-       theLyXFunc().setLyXView(&view);
-
-       view.init();
-       view.setGeometry(width, height, posx, posy, LyXView::Maximized(maximized),
-               iconSizeXY, geometryArg);
-
-       view.setFocus();
-
-       setCurrentView(view);
-
-       return view;
-}
-
-
 LyXView const * Application::currentView() const
 {
        return current_view_;
index 8350b5cc46d4611c9b2d9cd49a1439149989c4e7..63e593d9186f196f86332b3ece16c47c3bfe029e 100644 (file)
@@ -214,9 +214,9 @@ public:
        virtual void unregisterSocketCallback(int fd) = 0;
 
        /// Create the main window with given geometry settings.
-       LyXView & createView(unsigned int width, unsigned int height,
+       virtual LyXView & createView(unsigned int width, unsigned int height,
                int posx, int posy, int maximized,
-               unsigned int iconSizeXY, const std::string & geometryArg);
+               unsigned int iconSizeXY, const std::string & geometryArg) = 0;
 
        ///
        LyXView const * currentView() const;
index 7bf6ca7dd3195ee5f0bd4ce4258ee9e96708ea1a..06ac5c434350847a5fb43c2ec6682e8389513f7c 100644 (file)
@@ -38,7 +38,7 @@ public:
        virtual ~Gui() {}
 
        ///
-       virtual LyXView& createRegisteredView() = 0;
+       virtual int createRegisteredView() = 0;
        ///
        virtual bool unregisterView(int id) = 0;
        ///
index f29529fd959aea824538032673e097c9d3b8f95e..14de46024ca9a8588f1af6b588b9418009829f3b 100644 (file)
@@ -64,22 +64,6 @@ public:
         */
        virtual void init() = 0;
 
-       enum Maximized {
-               NotMaximized,
-               VerticallyMaximized,
-               HorizontallyMaximized,
-               CompletelyMaximized
-       };
-
-       ///
-       virtual void setGeometry(
-               unsigned int width,
-               unsigned int height,
-               int posx, int posy,
-               Maximized maximize,
-               unsigned int iconSizeXY,
-               const std::string & geometryArg) = 0;
-
        /// show busy cursor
        virtual void setBusy(bool) = 0;
 
index 5404d6d453376e920d90b1cadca008ce073e27ad..2203252d63489ea73b0e78783d8602ac1b303f41 100644 (file)
 
 #include "GuiApplication.h"
 
+#include "GuiView.h"
 #include "qt_helpers.h"
 #include "GuiImage.h"
 
 #include "frontends/alert.h"
-#include "frontends/LyXView.h"
 
 #include "graphics/LoaderQueue.h"
 
@@ -194,6 +194,31 @@ GuiApplication::~GuiApplication()
 }
 
 
+LyXView & GuiApplication::createView(unsigned int width,
+                                 unsigned int height,
+                                 int posx, int posy,
+                                 int maximized,
+                                 unsigned int iconSizeXY,
+                                 const std::string & geometryArg)
+{
+       int const id = gui_.createRegisteredView();
+       GuiView & view = static_cast<GuiView &>(gui_.view(id));
+       theLyXFunc().setLyXView(&view);
+
+       view.init();
+       view.setGeometry(width, height, posx, posy, GuiView::Maximized(maximized),
+               iconSizeXY, geometryArg);
+
+       view.setFocus();
+
+       setCurrentView(view);
+
+       return view;
+}
+
+
+
+
 Clipboard & GuiApplication::clipboard()
 {
        return clipboard_;
index 3ba4800f885aae21918044d24d7572d4f9e850d2..8768d4b7bee51bab68dc197aaf2972b832692442 100644 (file)
@@ -70,6 +70,10 @@ public:
        virtual void updateColor(ColorCode col);
        virtual void registerSocketCallback(int fd, SocketCallback func);
        void unregisterSocketCallback(int fd);
+       /// Create the main window with given geometry settings.
+       LyXView & createView(unsigned int width, unsigned int height,
+               int posx, int posy, int maximized,
+               unsigned int iconSizeXY, const std::string & geometryArg);
        //@}
 
        /// Methods inherited from \c QApplication class
index 99c287118603e9657ecf109472192481908141ab..d234d6446b672dd2217b6b5ca4d6bbfaab3c60c6 100644 (file)
@@ -42,7 +42,7 @@ GuiImplementation::GuiImplementation()
 }
 
 
-LyXView& GuiImplementation::createRegisteredView()
+int GuiImplementation::createRegisteredView()
 {
        updateIds(views_, view_ids_);
        int id = 0;
@@ -50,7 +50,7 @@ LyXView& GuiImplementation::createRegisteredView()
                id++;
        views_.insert(std::pair<int, GuiView *>(id, new GuiView(id)));
        updateIds(views_, view_ids_);
-       return *views_[id];
+       return id;
 }
 
 
index 72917ca6f709ea83379a19d57d05e7f670531cb3..38a51e5aa693c4f6877c946cfb076ec7634e27de 100644 (file)
@@ -36,7 +36,7 @@ public:
        GuiImplementation();
        virtual ~GuiImplementation() {}
 
-       virtual LyXView& createRegisteredView();
+       virtual int createRegisteredView();
        virtual bool closeAllViews();
        virtual bool unregisterView(int id);
 
index 17b46f85ebe177e8798c486d484f4916a75b8839..19759591ed42c2b13fbf45391e78d03c0fe2539f 100644 (file)
@@ -497,7 +497,7 @@ void GuiView::saveGeometry()
 void GuiView::setGeometry(unsigned int width,
                          unsigned int height,
                          int posx, int posy,
-                         LyXView::Maximized maximized,
+                         GuiView::Maximized maximized,
                          unsigned int iconSizeXY,
                          const string & geometryArg)
 {
index 943dc1154071a8d2f78870bcbfbb8a1717cc3de7..5bd7b3f24ca5c3b99552a805bcd057cac4d98a79 100644 (file)
@@ -59,6 +59,14 @@ public:
        virtual void init();
        virtual void close();
        virtual void setFocus();
+
+       enum Maximized {
+               NotMaximized = 0, // LyX::newLyXView() relies on this to be zero!
+               VerticallyMaximized,
+               HorizontallyMaximized,
+               CompletelyMaximized
+       };
+       ///
        virtual void setGeometry(
                unsigned int width,
                unsigned int height,
@@ -198,9 +206,6 @@ private:
        ///
        void setIconSize(unsigned int size);
 
-       /// toggle toolbar state
-       void toggleToolbarState(std::string const & name, bool allowauto);
-
        ///
        struct GuiViewPrivate;
        GuiViewPrivate & d;