2006-09-22 17:50:33 +00:00
|
|
|
/**
|
|
|
|
* \file frontend/Application.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "Application.h"
|
|
|
|
|
2006-09-29 22:06:28 +00:00
|
|
|
#include "Application_pimpl.h"
|
|
|
|
#include "Gui.h"
|
|
|
|
|
2006-09-22 17:50:33 +00:00
|
|
|
#include "LyXAction.h"
|
2006-09-29 22:06:28 +00:00
|
|
|
#include "lyxfunc.h"
|
2006-09-22 17:50:33 +00:00
|
|
|
#include "lyxrc.h"
|
|
|
|
#include "LyXView.h"
|
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "support/os.h"
|
|
|
|
#include "support/package.h"
|
|
|
|
|
|
|
|
|
|
|
|
using lyx::support::package;
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2006-09-22 19:17:29 +00:00
|
|
|
Application::Application(int &, char **)
|
2006-09-22 17:50:33 +00:00
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
pimpl_ = new Application_pimpl;
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXFunc & Application::lyxFunc()
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
return *pimpl_->lyxfunc_.get();
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXFunc const & Application::lyxFunc() const
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
return *pimpl_->lyxfunc_.get();
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXServer & Application::server()
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
return *pimpl_->lyx_server_.get();
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXServer const & Application::server() const
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
return *pimpl_->lyx_server_.get();
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXServerSocket & Application::socket()
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
return *pimpl_->lyx_socket_.get();
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXServerSocket const & Application::socket() const
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
return *pimpl_->lyx_socket_.get();
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-27 10:24:13 +00:00
|
|
|
BufferList & Application::bufferList()
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
return pimpl_->buffer_list_;
|
2006-09-27 10:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BufferList const & Application::bufferList() const
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
return pimpl_->buffer_list_;
|
2006-09-27 10:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-22 17:50:33 +00:00
|
|
|
void Application::setBufferView(BufferView * buffer_view)
|
|
|
|
{
|
|
|
|
buffer_view_ = buffer_view;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Application::start(std::string const & batch)
|
|
|
|
{
|
2006-09-29 22:06:28 +00:00
|
|
|
pimpl_->lyx_server_.reset(new LyXServer(pimpl_->lyxfunc_.get(), lyxrc.lyxpipes));
|
|
|
|
pimpl_->lyx_socket_.reset(new LyXServerSocket(pimpl_->lyxfunc_.get(),
|
2006-09-22 17:50:33 +00:00
|
|
|
lyx::support::os::internal_path(package().temp_dir() + "/lyxsocket")));
|
|
|
|
|
|
|
|
// handle the batch commands the user asked for
|
|
|
|
if (!batch.empty()) {
|
2006-09-29 22:06:28 +00:00
|
|
|
pimpl_->lyxfunc_->dispatch(lyxaction.lookupFunc(batch));
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|