]> git.lyx.org Git - lyx.git/blob - src/frontends/Application.C
c75767280cab46310d19af9dfb1d9b5ec9e2facf
[lyx.git] / src / frontends / Application.C
1 /**
2  * \file frontend/Application.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Abdelrazak Younes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "Application.h"
14
15 #include "funcrequest.h"
16 #include "LyXAction.h"
17 #include "lyxrc.h"
18 #include "LyXView.h"
19
20 #include "support/lstrings.h"
21 #include "support/os.h"
22 #include "support/package.h"
23
24 #include <boost/scoped_ptr.hpp>
25
26 using lyx::support::package;
27
28 namespace lyx {
29 namespace frontend {
30
31
32 Application::Application(int & argc, char ** argv)
33 {
34 }
35
36
37 LyXFunc & Application::lyxFunc()
38 {
39         return *lyxfunc_.get(); 
40 }
41
42
43 LyXFunc const & Application::lyxFunc() const
44 {
45         return *lyxfunc_.get(); 
46 }
47
48
49 LyXServer & Application::server()
50 {
51         return *lyx_server_.get(); 
52 }
53
54
55 LyXServer const & Application::server() const 
56 {
57         return *lyx_server_.get(); 
58 }
59
60
61 LyXServerSocket & Application::socket()
62 {
63         return *lyx_socket_.get();
64 }
65
66
67 LyXServerSocket const & Application::socket() const
68 {
69         return *lyx_socket_.get();
70 }
71
72
73 void Application::setBufferView(BufferView * buffer_view)
74 {
75         buffer_view_ = buffer_view;
76 }
77
78
79 int Application::start(std::string const & batch)
80 {
81         lyx_server_.reset(new LyXServer(lyxfunc_.get(), lyxrc.lyxpipes));
82         lyx_socket_.reset(new LyXServerSocket(lyxfunc_.get(), 
83                 lyx::support::os::internal_path(package().temp_dir() + "/lyxsocket")));
84
85         // handle the batch commands the user asked for
86         if (!batch.empty()) {
87                 lyxfunc_->dispatch(lyxaction.lookupFunc(batch));
88         }
89
90         return exec();
91 }
92
93
94 } // namespace frontend
95 } // namespace lyx