Abdelrazak Younes wrote:
Hum... I've done the change (see attached) but it's more complicated
than that. For example, InsetMathNest.C should not care about BufferList
but I need to include "bufferlist.h" to avoid this compilation error
below. Any idea someone?
With the pimpl_ implementation attached, InsetMathNest.C compiles fine.
Does that suit you?
Abdel.
Index: Application.C
===================================================================
--- Application.C (revision 15161)
+++ Application.C (working copy)
@@ -12,9 +12,13 @@
#include "Application.h"
+#include "bufferlist.h"
#include "funcrequest.h"
#include "LyXAction.h"
+#include "lyxfunc.h"
#include "lyxrc.h"
+#include "lyxserver.h"
+#include "lyxsocket.h"
#include "LyXView.h"
#include "support/lstrings.h"
@@ -25,60 +29,76 @@
using lyx::support::package;
+struct Application_pimpl
+{
+ // FIXME: lyxfunc_ should be private. But the actual construction is
done in
+ // GuiApplication for now.
+
+ /// our function handler
+ boost::scoped_ptr<LyXFunc> lyxfunc_;
+
+ ///
+ boost::scoped_ptr<LyXServer> lyx_server_;
+ ///
+ boost::scoped_ptr<LyXServerSocket> lyx_socket_;
+ ///
+ boost::scoped_ptr<BufferList> buffer_list_;
+};
+
namespace lyx {
namespace frontend {
-
Application::Application(int &, char **)
{
+ pimpl_ = new Application_pimpl;
}
LyXFunc & Application::lyxFunc()
{
- return *lyxfunc_.get();
+ return *pimpl_->lyxfunc_.get();
}
LyXFunc const & Application::lyxFunc() const
{
- return *lyxfunc_.get();
+ return *pimpl_->lyxfunc_.get();
}
LyXServer & Application::server()
{
- return *lyx_server_.get();
+ return *pimpl_->lyx_server_.get();
}
LyXServer const & Application::server() const
{
- return *lyx_server_.get();
+ return *pimpl_->lyx_server_.get();
}
LyXServerSocket & Application::socket()
{
- return *lyx_socket_.get();
+ return *pimpl_->lyx_socket_.get();
}
LyXServerSocket const & Application::socket() const
{
- return *lyx_socket_.get();
+ return *pimpl_->lyx_socket_.get();
}
BufferList & Application::bufferList()
{
- return buffer_list_;
+ return *pimpl_->buffer_list_.get();
}
BufferList const & Application::bufferList() const
{
- return buffer_list_;
+ return *pimpl_->buffer_list_.get();
}
@@ -90,13 +110,13 @@
int Application::start(std::string const & batch)
{
- lyx_server_.reset(new LyXServer(lyxfunc_.get(), lyxrc.lyxpipes));
- lyx_socket_.reset(new LyXServerSocket(lyxfunc_.get(),
+ pimpl_->lyx_server_.reset(new LyXServer(pimpl_->lyxfunc_.get(),
lyxrc.lyxpipes));
+ pimpl_->lyx_socket_.reset(new LyXServerSocket(pimpl_->lyxfunc_.get(),
lyx::support::os::internal_path(package().temp_dir() +
"/lyxsocket")));
// handle the batch commands the user asked for
if (!batch.empty()) {
- lyxfunc_->dispatch(lyxaction.lookupFunc(batch));
+ pimpl_->lyxfunc_->dispatch(lyxaction.lookupFunc(batch));
}
return exec();
Index: Application.h
===================================================================
--- Application.h (revision 15161)
+++ Application.h (working copy)
@@ -11,18 +11,18 @@
#ifndef LYX_APPLICATION_H
#define LYX_APPLICATION_H
-#include "bufferlist.h"
-#include "lyxfunc.h"
-#include "lyxserver.h"
-#include "lyxsocket.h"
-
#include <boost/scoped_ptr.hpp>
#include <string>
+class BufferList;
class BufferView;
-class LyXView;
+class LyXFunc;
+class LyXServer;
+class LyXServerSocket;
+struct Application_pimpl;
+
namespace lyx {
namespace frontend {
@@ -30,7 +30,6 @@
class Gui;
class Selection;
-
/// The main application class
/**
There should be only one instance of this class. No Qt object
@@ -78,20 +77,8 @@
protected:
///
BufferView * buffer_view_;
-
- // FIXME: lyxfunc_ should be private. But the actual construction is
done in
- // GuiApplication for now.
-
- /// our function handler
- boost::scoped_ptr<LyXFunc> lyxfunc_;
-
-private:
///
- boost::scoped_ptr<LyXServer> lyx_server_;
- ///
- boost::scoped_ptr<LyXServerSocket> lyx_socket_;
- ///
- BufferList buffer_list_;
+ Application_pimpl * pimpl_;
}; // Application