]> git.lyx.org Git - features.git/commitdiff
* LyX class (lyx_main.[Ch]):
authorAbdelrazak Younes <younes@lyx.org>
Wed, 11 Oct 2006 22:30:31 +0000 (22:30 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 11 Oct 2006 22:30:31 +0000 (22:30 +0000)
  - new buffer_list_ member and accessors
  - implementation of theBufferList() extern function

* Application: remove everything related to BufferList

* lyx_cb.C: test for lyx::use_gui before using theApp.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15303 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/Application.C
src/frontends/Application.h
src/lyx_cb.C
src/lyx_main.C
src/lyx_main.h

index 545b15e33ab961f181f0d902b9d9d163c71e4887..5b8d846b596e8cbd5cc077954099c74dfd32adb7 100644 (file)
@@ -41,8 +41,6 @@ namespace frontend {
 /// The main application class private implementation.
 struct Application_pimpl 
 {
-       ///
-       BufferList buffer_list_;
        /// our function handler
        boost::scoped_ptr<LyXFunc> lyxfunc_;
        ///
@@ -94,18 +92,6 @@ LyXServerSocket const & Application::socket() const
 }
 
 
-BufferList & Application::bufferList()
-{
-       return pimpl_->buffer_list_;
-}
-
-
-BufferList const & Application::bufferList() const
-{
-       return pimpl_->buffer_list_;
-}
-
-
 void Application::setBufferView(BufferView * buffer_view)
 {
        buffer_view_ = buffer_view;
@@ -177,12 +163,6 @@ LyXFunc & theLyXFunc()
 }
 
 
-BufferList & theBufferList()
-{
-       return theApp->bufferList();
-}
-
-
 lyx::frontend::FontLoader & theFontLoader()
 {
        return theApp->fontLoader();
index d9589f8078d11dfde3b000a9867c43c9b8186675..b1eff4ecfa1e5eda62273ef30360d72443ef6a93 100644 (file)
@@ -87,9 +87,6 @@ public:
        ///
        LyXServerSocket & socket();
        LyXServerSocket const & socket() const;
-       ///
-       BufferList & bufferList();
-       BufferList const & bufferList() const;
 
        /// Create the main window with given geometry settings.
        LyXView & createView(unsigned int width, unsigned int height,
index 6cbe384d13e0b1df17045669d0f8065e162d458a..0735a98f9803445709a99213e7183de6c1dd99e8 100644 (file)
@@ -216,7 +216,9 @@ void quitLyX(bool noask)
                Alert::warning(_("Unable to remove temporary directory"), msg);
        }
 
-       theApp->exit(0);
+       if (lyx_gui::use_gui)
+               theApp->exit(0);
+
        // Restore original font resources after Application is destroyed.
        lyx::support::restoreFontResources();
 }
index 0f98482706610fda0251d3d22b35f565d7429128..6a05a113a51503c4f054dd6bea4633ae4857813c 100644 (file)
@@ -169,9 +169,29 @@ LyX const & LyX::cref()
 }
 
 
+BufferList & theBufferList()
+{
+       return LyX::ref().bufferList();
+}
+
+
 LyX::LyX()
        : first_start(false), geometryOption_(false)
-{}
+{
+       buffer_list_.reset(new BufferList);
+}
+
+
+BufferList & LyX::bufferList()
+{
+       return *buffer_list_.get();
+}
+
+
+BufferList const & LyX::bufferList() const
+{
+       return *buffer_list_.get();
+}
 
 
 lyx::Session & LyX::session()
index 55fdd631b6e63258da3d4d1a11092d09b6b987f9..c791c605f8aa4ba913698fe1fb6c58d58deaccb9 100644 (file)
@@ -22,6 +22,7 @@
 #include <string>
 
 class Buffer;
+class BufferList;
 class ErrorItem;
 class InsetBase;
 class LyXView;
@@ -55,6 +56,10 @@ public:
        /// in the case of failure
        void emergencyCleanup() const;
 
+       ///
+       BufferList & bufferList();
+       BufferList const & bufferList() const;
+       ///
        lyx::Session & session();
        lyx::Session const & session() const;
 
@@ -102,6 +107,8 @@ private:
        /// the parsed command line batch command if any
        std::string batch_command;
 
+       ///
+       boost::scoped_ptr<BufferList> buffer_list_;
        /// lyx session, containing lastfiles, lastfilepos, and lastopened
        boost::scoped_ptr<lyx::Session> session_;
        ///